Connor - Programming Review Lesson 1 and notes

This is a simple review of the first 6 hours coding we've done together so far. If you want we can use this site deliberately to build up a record of the ideas and syntax you've had to learn so far.

This actual page will be updated with bits of code and maybe some pictures as necessary. We can also build you a site of your own to play with if you want to do html/css.

Finally, we can also work out a means of summarising our maths lessons and your own maths knowledge here if you want.

This is the stuff we covered last week and previously:

Programming ideas:

	//A class is a cookie cutter for an object
public class NumberWizard : MonoBehaviour
    {
    //Some boxes to hold our min/max and initial guess
    int max = 1000;
    int min = 1;
    int guess = 500;
    
    //This only happens once, when you first play the game in Unity
    void Start()
        {
        print("Welcome to Number Wizard");
        print("Pick a number in your head but don't tell me.");
        print("The highest number you can pick is " + max); //Remember we could add the contents of a box, the value within to be printed out.
        print("The minimum number you can pick is " + min);

        print("Is the number higher or lower than 500?");
        print("Up = for higher, down = lower, return = equals");
        
        }

    //We decided that this is being used twice, so we made a new function. It's selfish (Void). It does it's job but gives nothing back.
    void Guess()
        {
            guess = (max + min) / 2;
            print("Higher or lower than" + guess);
        }

    // Update is called once per frame - this is specific to Unity
    void Update()
        {
        if (Input.GetKeyDown(KeyCode.UpArrow)) //What key did we press?
            {
                min = guess; //Notice we use a different box to put our guess in depending if you hit up or down arrow.
                Guess(); //Call our Guess function
            } else if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                max = guess;
                Guess();
            }
        else if (Input.GetKeyDown(KeyCode.Return))
            {
                print("I won so na na ne na nah!!!");
            }
        }


    }

Some terminalogy used so far:

This is a bonus bit: I think you should consider knowing this :). http://readwrite.com/2013/09/30/understanding-github-a-journey-for-beginners-part-1