Computer Science Canada Creating guessing games |
Author: | iNsteReo [ Thu Apr 30, 2009 12:04 pm ] | ||
Post subject: | Creating guessing games | ||
What is it you are trying to achieve? I am trying to create a program that would randomly select the order of 4 colors. After this, the user sees 4 boxes( of the same 4 colors, but not in the same order). The user then clicks on the the boxes in order which he thinks the program set the colors in. Then there are 4 LEDS on the outside of the computer, connected to the computer through parallel circuit. The LEDS light up according to how many correct colors the user guessed ( if he got the first and the last color right, the 1st and last LED light up) What is the problem you are having? My problem is making the program random the colors and then getting the user input and matching the user input to the randomed colors. Describe what you have tried to solve this problem I tried to put the 4 colors in an array and randomize it. But i honestly do not even know how to start solving this. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) i started out with a little different program, because i know how to this and not what is needed.
Please specify what version of Turing you are using 4.0.5. |
Author: | tjmoore1993 [ Thu Apr 30, 2009 3:14 pm ] | ||
Post subject: | RE:Creating guessing games | ||
Try using a procedure to randomize by using
Use the Rand.Int code to randomize an order and use an IF statement. If you still have problems ask ![]() |
Author: | DtY [ Thu Apr 30, 2009 4:29 pm ] | ||
Post subject: | RE:Creating guessing games | ||
Something like this would work, and it might be what tjmoore1993 is suggesting. Note, this code has not been tested
used could also be an array of booleans. |