Rakibul Mahin

Greenhorn
+ Follow
since Jul 03, 2020
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
2
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rakibul Mahin




Finally I solved the Problem

Thanks for helping
2 weeks ago

Paul Clapham wrote:

Rakibul Mahin wrote:Ok So I tried and I am stuck here I am not getting desired output



It's frustrating when that happens, but for programmers it's normal for code not to work right the first time. So what you need to do is this: you need to look at the output you get and examine how it differs from the desired output. That could possibly lead you to the code which is wrong.



I did and I can't find any error, basically I should have one winner and it should eliminate whenever random generated number i 1, but it is not happening help me.

2 weeks ago



Ok So I tried and I am stuck here I am not getting desired output
2 weeks ago

salvin francis wrote:

Piet Souris wrote:... The outcome does not depend on the number of chairs or the length of the music playing. Are you perhaps modelling that famous game, often played at wedding parties?


I think OP's description is a variation of the game played at wedding parties. The game we play using using real people usually involves one less chair than the number of persons and when music stops, the running and pushing begins ;)

OP's variation might be as follows:

Let's assume that the people are numbered 1 to 7 as 1,2,3,4,5,6,7
assuming clockwise rotation, it would make the first iteration as 2,3,4,5,6,7,1
second iteration as 3,4,5,6,7,1,2
and so on...

There's a 1 in 4 chance of the music stopping at any iteration since we're looking at choosing a number at random between the intervals 0 to 3
Once the music stops, the person in the center leaves (I am assuming round off to highest value here), so if the music stops at second iteration, 7/2 ~= 4th person leaves.
New list would now have only 6 numbers: 3,4,5,7,1,2
and so on...


A few questions for OP:

Do let us know if my assumptions are correct. If yes, how are you going to solve this using code ?
Do you know how looping works ?
Do you know how to use Lists ?



yes you are correct
2 weeks ago

salvin francis wrote:

Piet Souris wrote:... The outcome does not depend on the number of chairs or the length of the music playing. Are you perhaps modelling that famous game, often played at wedding parties?


I think OP's description is a variation of the game played at wedding parties. The game we play using using real people usually involves one less chair than the number of persons and when music stops, the running and pushing begins ;)

OP's variation might be as follows:

Let's assume that the people are numbered 1 to 7 as 1,2,3,4,5,6,7
assuming clockwise rotation, it would make the first iteration as 2,3,4,5,6,7,1
second iteration as 3,4,5,6,7,1,2
and so on...

There's a 1 in 4 chance of the music stopping at any iteration since we're looking at choosing a number at random between the intervals 0 to 3
Once the music stops, the person in the center leaves (I am assuming round off to highest value here), so if the music stops at second iteration, 7/2 ~= 4th person leaves.
New list would now have only 6 numbers: 3,4,5,7,1,2
and so on...


A few questions for OP:

Do let us know if my assumptions are correct. If yes, how are you going to solve this using code ?
Do you know how looping works ?
Do you know how to use Lists ?



Yes, I also knew that this game is player with one less chair, but here it is different.

let me give you a small demo:

person = {"A","B","C","D","E","F","G"}

numberOfPersonAlive = 7

while numberOfPersonAlive != 1:
   generateRandomNumberBetween0to3 = generateRandom()
   if generateRandomNumberBetween0to3 == 1:
       remove player from (numberOfPersonAlive / 2) chair
       numberOfPersonAlive -= 1
   else:
       rotate


After one elimination I should have six person something similar to below:


person = {"A","B","C","D","E","F",null}









2 weeks ago
Ok, so we are told that we need to use circular arrays and if our random number is not 1 then we have to keep rotating. And when we will get 1 then we will eliminate n/2 position player from the start, here n is number of players in game.
2 weeks ago
I took permission from our faculty and he said i can use built in random generator now i'm facing problem maintaing cirular array after each elimination.

2 weeks ago

Tim Moores wrote:That's not how these forums work. If you describe in detail where you're stuck, we'll help you get going, but nobody here is going to chat/phone you through it.


This is the question and I am still stuck at this I'm not getting how am I suppose to keep this whole array circular through my whole journey.

Suppose you have been hired to develop a musical chair game. In this game there will be
7 participants and all of them will be moving clockwise around a set of 7 chairs organized
in a circular manner while a music will be played in the background. You will control the
music using random numbers between 0-3.If the generated random number is 1, you will
stop the music and if the number of participants who are still in the game is n, the
participant at position (n/2) will be eliminated. Each time a participant is eliminated, a
chair will be removed and you have to print the player names who are still in the game.
The game will end when there will be only one participant left. At the end of the game,
display the name of the winner.
2 weeks ago

fred rosenberger wrote:Where exactly are you stuck?  



basically I got one assignment and I am stuck, I can't do few things so it would be helpful if we can stay on a call and then solve the problem
2 weeks ago
I need one big help can anyone please give me their discord ID or something so that I can be on call and then solve those problem??
2 weeks ago
Hello, I need a big help is there anyone who knows how to create a random generator in java. I am not talking about the built in one.

Thank You
2 weeks ago
I really don't know anything about stack so far, and yes i could have used 2nd list but the question says not to use it, and yes i could have recursion too which didn't come to my mind
3 weeks ago
yes, it is going to be same.
3 weeks ago

Carey Brown wrote:Ah, looks like you are just trying to make the prev links into next links and vice versa. You'd also need to reset head to point to the other end of the list.



Oh yes Thanks a lot man I got the solution

3 weeks ago
Method Overloading: When we have one class and we have two methods with same name but different parameters, this is known as method overloading.
Let me give you an example:



So, it will depend on the user that how many parameters will be passed, now if the user passes let's say 5 numbers then the program will look for the sum method for 5 parameters it will not find any and it will show error

Method Overriding: This is for two different classes with same method name and parameters but in different classes. Now the action might not be the same here, let me give you an example: Lets assume your father have a phone, now you can say your friends to call at your fathers phone to contact you (As you don't have a phone), you are inherited from your father. Now you got a phone will you tell your friends to call you father anymore??



So this is how it works not lets say if the son didn't have a phone then probably he would use super function to call.

if there is any mistake please do corrections, there might be some syntax errors forgive me for those.
3 weeks ago