Write a program to let a child practice reading dice correctly. You should display two dice randomly chosen at the top of the screen, with a choice of boxes 2 through 12 underneath. The child clicks on a box, gets a response whether she is correct or not, and two new dice are displayed. After ten questions, a summary of how many the child got correct is printed on a new screen, and two boxes marked play_again and quit are displayed. The child then chooses whether to continue playing or not by clicking in the appropriate box.
This program will teach you how to put all the basics you have learned together into a large program. You should learn how to use parameters, design in a top-down clear manner, and use graphical user interfaces.
Here is an outline of the top procedure.
To inclass_dice
make "num_games 0; data structures to keep total average score
make "total_correct 0
play_the_game ; This is where you have to do all your work.
; Inside play_the_game you will need
; make "total_right 0
; "total_right keeps track of how many answers the kid gets right out of ten in a single game
; This procedure tests the kid 10 times, keeps track of how many the kid gets correct,
; prints out appropriate messages and summaries of the scores so far.
; It is similar in function to the odd-even program "quiz"
; At the end of play_the_game you will need a play again section consisting of:
make "total_correct (+ :total_correct :total_right)
make "num_games (+ :num_games 1)
; update num_games and "total_correct
draw_play_again
; draws a box with the word "play_again" in it
draw_quit
; draws a box with the word "quit" in it
if (= getanswer "quit) then final_message stop
play_the_game
end
; getanswer returns "quit if the person clicks in the "quit" box, and "play if the person clicks in "play again"
; final_message makes a final report to the kid inclass_dice
Strategies, hints, and good style will be discussed in class both in general and one on one in individual groups.