Sunday, September 19, 2010

Theory for the Assignment

Introduction

(Replace this with:  what is the purpose or problem that the program is trying to solve)
You are playing an adapted version of scissors, paper, rock against the computer. The computer randomly chooses an option so you can never predict what will happen which makes it quite hard. Instead of the original scissors, paper and rock there is a Wizard, Ninja and Knight which should make the game more interesting and enticing to play.  You have to choose a character and what the computer has randomly chosen will determine the outcome of the game.

Algorithm Outlining the Program




Explanation of Data Types used

(What types are used in the variables in your program and where ? Remember the DIM statement)
Text- There are labels for the instructions, score, the outcome (whether you won, lost or drew) and the line “chose your character” and there’s also text on the buttons so the user wil know what each button does. In the code of buttons 1, 2 and 3 I put in text for the label which tells you the outcome of your choice.  
Integer- The variable ‘Score’ is an integer. This variable allows the whole game to happen as this is what makes the computer choices randomly. The random choice of the computer determines whether you win, lose or draw.


Use of Error Detection

(explain how your program handles incorrect user inputs)
I designed it so that there can’t be any incorrect user inputs. The use of buttons instead of textboxes stops the user from incorrectly entering their choice of character. The labels stop the user from accidently changing the instructions or their score. The whole thing is click based so the user doesn’t type anything incorrect.


Control Structure examples

(copy and paste the appropriate section from your program and explain)
Sequence: You click your choice of character. Then the computer randomly choses a number. The number chosen will determine the outcome of the game therefore what is displayed (whether you win, lose or draw). If you win then another image will change. The computer doesn’t chose the number before you chose your character and the image doesn’t change before you chose your character. First bit of code:

2nd:

3rd:

4th:


5th:


Selection: You have to chose your character button or the new game button for something to  happen.
Repetition: There isn’t any repetition. Only if the user repeats an action. Eg, clicking a character.

No comments:

Post a Comment