Finch Plays Simon
Program your Finch to play a modified version of the memory game Simon. In the game you will write, the Finch will print an orientation, either Beak Up, Beak Down, Left Wing Down, or Right Wing Down. You will then need to move the Finch to that orientation. If you do this successfully, the Finch will print a new orientation – you‟ll have to move the Finch to the first orientation, then to the new one.
This game goes on for as many moves as you can remember. When you finally mess up, the Finch will tell you how many moves in a row you got right, and either compliment or insult your performance. Here's the details:
Start a loop that ends when the player makes an incorrect move. The loop should:
- Randomly generate a new move: Beak Up, Beak Down, Left Wing Down, or Right Wing Down
- Add the new move to a list
- Print what the move is
- Print that the user needs to repeat all of the moves done so far.
At this point, you should create a loop that goes through every move on the list, starting with the first one created. This loop checks that a move is correct by calling a function named moveCorrect().
moveCorrect() returns a Boolean value, and is passed a string. For each of the four possible moves, check if the Finch is in the orientation indicated by the string (Beak Up, Beak Down, Left Wing Down, or Right Wing Down). Give the player five seconds to get to the correct position. If the player gets to the correct position at any time within five seconds, the moveCorrect() function should return true. Otherwise, moveCorrect() should return false.
If the player gets a correct move, the Finch's beak should flash green for 1 second, and the Finch should beep happily. If the player correctly gets the whole sequence, your overall loop should continue and generate a new move for them to remember. If they mess up, the program should tell them the maximum number of moves they reached.
The Finch should also render judgment – if the total moves are less than 4, insult the user for having a bad memory. For 4-8 moves, tell them to try harder next time. For 9 moves or more, congratulate the user.