1
Ask a Question / how to get random item from list, check to see it it doesnt equal something
« on: January 02, 2012, 02:28:56 pm »
I have a game where I click on countries and if I click right I change the color of the country black and replace that countries name in the list with done. I do that so I can keep track of where all the countries are in the list. I have like 38 countries in a list called countries. A country name is printed
on the screen. I click it, it turns black. Its name in the list is changed to done. After that I need
to randomly get an item from the list so I can print another random country thats left to click on.
I need to check if that item does not equal done. If it doesnt then that item will be printed. If
it does equal done I need to get another random item from the list and check again. I have to do
that till I get an item returned that isnt equal to done. Can anyone right a behavior to do that?
I have tried numerous ways and no luck. It either does nothing, returns true or false or just cycles
through all the items nonstop. Thanks.
on the screen. I click it, it turns black. Its name in the list is changed to done. After that I need
to randomly get an item from the list so I can print another random country thats left to click on.
I need to check if that item does not equal done. If it doesnt then that item will be printed. If
it does equal done I need to get another random item from the list and check again. I have to do
that till I get an item returned that isnt equal to done. Can anyone right a behavior to do that?
I have tried numerous ways and no luck. It either does nothing, returns true or false or just cycles
through all the items nonstop. Thanks.