Musical Chairs Sim

debugging
#1

I’m working on a musical chairs simulator. Currently The circles are supposed to randomize to go to whichever chair. For each chair, if they already have a chair they are supposed to stay on that one chair. Right now, only a few of the circles go to chairs even though all except one are supposed to get a chair. Can someone please help me?
@CodeHelp

10 Likes
#3

Try adding two more chair values

4 Likes
#4

There are already 7 chair values, that should be enough…but it doesn’t work…

3 Likes
#5

Just try adding them

3 Likes
#6

If the circles are set randomly biased on chairs, perhaps check if the variable that tells the circles to go to a chair, maybe it’s trying to put circles on empty spaces becuase a chair was already removed??

4 Likes
#7

No. The chair that was removed doesn’t exist. It’s not an object.

3 Likes
#8

TEM is updating is iPad. He will be back on soon…

3 Likes
#9

He is back on now…

3 Likes
#10

Thanks! I’m starting a new version of musical chairs, but it’s not randomized. Once I finish I think I’ll try incorporating the randomized again

4 Likes
#11

Cool! I can’t wait to see it! :D

1 Like
#12

Thanks :blush::blush::blush:

2 Likes
#13

I did some tests and I seems like sometimes two chairs will have the same circle that it’s assigned to

1 Like
#14


In this photo, the second square (second square is pink) is assigned 7 (the 2nd squares number is in corner ) but it seems like another square is assigned 7 also

#15

Hmmm. I included a variable that says if a number already has a chair, to re randomize the numbers…but that’s weird…

1 Like
#16

Could it be because in the code before that, I never check that the circle needs a chair before it goes to the position of the square?

2 Likes
#17

May you link a WIP so I edit it and show ya how to in pictures?

1 Like
#18

Yes it could be that!

It might also be that two squares are coincidentally changing to the same number (although my idea might be unlikely because it seems like the square values change a lot)

1 Like
#19


This is it

2 Likes
#20

Hmm ok what are you trying to do? Do people need to go to the closest chair when the music stops (Ik there’s no music)?

2 Likes
#21

Right now, the circles are just randomized to go to a chair. One circle randomizes the possibilities for a chair. Like it says set chair 1 to random 1 through 8. If the circle already has a chair, it is supposed to re randomize the circles for the chair the problem could be that it gets stuck for a very long time, but I need help preventing that…

1 Like