Here is the screen after the first player has scored an SOS:
The user had to draw the line and they clicked the button to update the score. Players take turns placing letters unless they can form an SOS. If they form an SOS they get to go again.
You can do this program from scratch if you like. If you would like some help you can use the following template that has had parts of the working program removed.
|
You can also use the following image files if you like: the S image, the O image and the blank image.
The tricky thing about this program is that the repaint will clear all the drawings off the screen that we've previously placed there. We need some way to remember all the things that were on the screen so we can redraw them. To do this we can use a 2-D array to keep track of where all the S's and O's are. We use another array to store all the end points of the lines that the user has drawn. The paint method needs to go through these arrays to recreate the screen every time a new letter or line is added.
Marking Scheme ____ 17 Proper Layout (2) ______ Score buttons & labels (3) ______ Places S & O properly (3) ______ Draws lines properly (3) ______ Remembers lines & letters (3) ______ Process Work (3) ______