My project was looking at primitive data types within Java. In my game a type is represented by the shape the user has selected (left and right mouse buttons change this “type”), either a square, circle or a triangle. In Java we will call these respectively; a Character (a single key stoke), an Integer (a number) and a Boolean (true of false). The shapes moving through the “pipe” are described as values. These shapes must be matched with the correct shape which is controlled by the user, otherwise the program will fail (Game Over). For example, trying to squeeze a circle into a triangle would be like telling the computer to hold 4,587,361 in a space it has allotted for either “True” or “False”. Imagine asking the computer if 1+1=2 and it said “4,587,361". For the sake of simplicity I haven’t covered java machine casting at runtime type checking, so please be aware in some cases a circle should be able to fit into both a square and a triangle!
The game doesn’t end if you just miss one shape, as I wanted to show that software can run with bugs (errors) in it. As the game progresses so does the complexity, more shapes will appear at a greater frequency, just as they would in a larger program. Obviously a larger program can potentially hide more ‘bugs’, therefore the higher you score the more ‘life’ the pipe gets back. This ‘health’ is represented by the colour of the pipe.
No comments:
Post a Comment