JavaApp goes to the UK

After the trip to Bletchley Park last friday, a student asked me if I could show him how to write computer programs (I think he mainly thought about ‚computer games‘). Today he and his friend had a closer look with me at the JavaApp framework.

In two hours I gave them a brief introduction (and got them clubbered about the head with information) to programming. They decided to write a version of criss-cross (?, don’t know if it’s correct, it’s Tic Tac Toe in Germany) and this is the result of their doing:

class cross extends JavaApp
{
    int player=1;
    public static void main(String[] args)
    {
        new cross();
    }

    void whenProgramStarts()
    {
        drawLine(0, -320, -50, 320, -50);
        drawLine(0, -320, 50, 320, 50);
        drawLine(0, -50, 240, -50, -240);
        drawLine(0, 50, -240, 50, 240);
    }

    void whenKey1IsPressed()
    {
        if(player==1)
            drawCircle(0, -160, 120, 20);
        else
            drawStringCentered(0, "X", -160, 120);
        if(player==1)
            player=2;
        else
            player=1;
    }
}

Edit: Tommy told me that the game is called ‚Naughts and crosses‘

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )

w

Verbinde mit %s

Bloggen auf WordPress.com.

Nach oben ↑

%d Bloggern gefällt das: