Counting Table Item Usage
Hey there gang,
I'm racking my brain trying to figure this issue out, and without being able to build a table, array style, I can't get it working. I have 8 items in a table, meaning 1 column and 8 rows. I am trying to find a way to use all 8 items twice, but I can't find an elegant way of keeping track of it. At the core of this, I'm making a memory style game with 16 cards. So, I'm hoping to randomly go through my table and fill out the cards. Does anyone know of a way to store the items you've already picked and then search against it if the item comes up again??
Thanks!
KevRo
I'm racking my brain trying to figure this issue out, and without being able to build a table, array style, I can't get it working. I have 8 items in a table, meaning 1 column and 8 rows. I am trying to find a way to use all 8 items twice, but I can't find an elegant way of keeping track of it. At the core of this, I'm making a memory style game with 16 cards. So, I'm hoping to randomly go through my table and fill out the cards. Does anyone know of a way to store the items you've already picked and then search against it if the item comes up again??
Thanks!
KevRo
Comments
That's a great idea, but I still have the issue of repeating objects. It makes it hard to use random(). Without a way to inform the dealing system, I may end up with repeat items from the same column, instead of 1 of 8 from that column, and 1 of 8 from the other. For example, let's use a color. The color Red is in (1,1)...when I deal the 16 cards, I want to have one Red card from (1,1), and another matching Red from (1,2). So there are only two Reds on the board at one time. I figured I would have to use random() to jumble the order, but I want to remove the possibility it can chose Red again after it's chosen it once from each column. I'm sure there is something easy out there to solve this. Hahahahaha.
--KevRo
I'm looking to do similar too, using a table of 40 rows for 40 questions and ask each question randomly and non repeating. Thinking of just creating 10 columns with different random orders and picking each, will be unique each 1/4 of the time.
Has there been any progress in GS in relation to non repeating row selection?
In JavaScript I'd normally use the Fisher–Yates Shuffle on an Array to create a random order (http://bost.ocks.org/mike/shuffle/).
Great thanks.