1+2=3 HTML5 game made in 100 lines of code – brackets included – using Phaser

There are fun and addictive games which seem really easy to code, and in most cases they are.

This is the case of 1+2=3 game for iOS. This is a very simple math game which all the questions and answers are combined by 1, 2, 3, plus and minus. You just have to tell the result of some simple sums like 1+1, 2+1, 3-2 and so on. You will always be using only 1, 2 and 3.

I tried to make the game in 100 lines of code, brackets included and with a correct indentation, and that’s what I got:

Using Phaser was really easy to create the game, and the only difficult thing – considering the 100 lines limit – was to find an algorithm to generate the random questions. I tried in various ways and eventually ended with a dirty trick.

Here is the game:

Click the button with 1, 2 or 3 according to the expression shown. When it’s game over, reload the game. What’s your best score?

A detailed tutorial about the making of this game will follow in a few days, meanwhile download the source code.

  • Worm1

    Hi , great game Emanuele !

    Can you explain a little how you make the algorithm to generate the random question ?

    Thx a lot !

    • Emanuele Feronato

      I will, when publishing next step

      • Worm1

        Thx , i would just understand how you increase difficulty of question ;)

  • this game has android version

  • Worm1

    I make an adaptation of the game with as3 on facebook :


    Enjoy .

    I ll prepare android version too.

  • Lucas

    When are you explaining the algo?