Friday, September 17, 2010

Programming Assessment Task Documentation

Introduction
(Replace this with: what is the purpose or problem that the program is trying to solve)

the purpose of the program is to provide a entertaining gabe which allows to enable two players/users to play tic tac toe against each other, and to result in either a win for one player/user or a no result.

Algorithm Outlining the Program
(put your flow chart here)



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 and the score, also text on the buttons to identify where the players opponent has placed either X or O, which therefor allows you the outcome of your choice (either a win or no result).
eg. button1.text= X and button2.text=X and button3.text=X then label1.text= Player X Wins !

Integer

the variable 'turn' in an integer. this variable allows the whole game to function as this is what allows the game to have more than one outcome.
eg. Dim turn as integer

Control Structure examples

(copy and paste the appropriate section from your program and explain)
Sequence:
You click on 1 of the 9 squares to allow the game to begin. Then your opponent attempts to change the outcome of the game by creating a no win situation.

Selection:

this section involves selection as it involves the words 'and' and 'else if'. These present to the computer conditions or a criteria that it must make a selection out of.

Repetition:

There is no repetition present within the program code. The only slight repition is the reset button which after the game results in either a win or no result, the player has the option to enable all buttons and to start again.

Use of Error Detection

The program handles incorrect user inputs and thereby stopping user created errors by limiting the options or possibilities for a user to enter incorrect values to start with. Through the use of buttons, the user is has no option other then to click on one of the nine buttons, as these are the only ones that are available. there is no room for user input error.

Friday, August 27, 2010

random



The INT function returns the integer part of a specified number.
Rnd is used to return psuedo-random values. These values may look random but because they use complex mathematical formulas they technically aren't random as they are still predictable.
Each time the program is run the psuedo-random values returned by Rnd are always the same. To overcome this you use randomize to initialise VB's random number generator. To avoid generating the same sequence of psuedo-random values you call randomize before you call Rnd.
To change the different values it can choose from you change the highest and lowest values. In the following code the highest is 10 and the lowest is 1. This means that it can choose a value between 1 and 10. You put it after: Handles Button1.Click

Thursday, August 26, 2010

timer


Hi LO Guessing Game





1) How many objects are referred to? What are they?
There's one variable, two text boxes and two buttons.

2) What is the name of the variable referred to?
secretnum

3) What are the three text options that appear in textbox1?
higher, lower and correct.

4) What do you think this code does?
You would enter a number in one of the text boxes and click a button but if the random number is higher, lower or if it's correct the other text box would tell you.

5) Well actually you should replace TextBox2 with a label and that means replacing TextBox2 in the code with Label1. This means that you can't enter something in the wrong textbox which is what I was doing which is why it wasn't working. In the original code I was entering a number where it shouldn't have been entered which is why you change it into a label because you can't enter a number in a label. The first button checks your answer and the second button resets it.

Wednesday, August 18, 2010

variables




A string is a sequence of characters. A string is like a data type storing a sequence of data values, usually bytes, where these usually stand for characters. That means that binary string and byte string are used to describe strings where the data they store but does not have to be text.


Integer variables are variables that must take an integer value; a whole number like 1 or 2. A special kind of integer variables is binary variables. Integer variables however will make the program more complex, making it take more time to solve things..

Thursday, August 12, 2010

and, or, not.

greater than, less than, equal too, less then and equal too.
^relational data operators !

a desk check is a way of manually stepping through a program and monitoring the change in variables.

test program.
tries to simulate unexpected values.

sample data.
data you expect will appear. to test its capability to work, stress test.

hertz - per second.
giga - bigger than mega, 1 000 000 000
mega - 1 000 000

when 'not' is the case, it is true ?

Friday, August 6, 2010

happy and sad / variables

and here is just some random code on variables, it really belongs somewhere else, but i'll fix that later !

we just were trying out some simple games here. the happy sad game is pretty simple and straightforward :)