Last edited 07dec09 by

Mathing: A Game Of Equation Making


This program is a mathematical game created using Python and OpenGL. The goal of the game is to create as many equations as possible by clicking on randomly generated numbers in a 4 by 4 grid.

The screen looks like this

Making the Program

I have gone through several versions of this game.

The first version had the player clicking on the numbers and then typing the operators, +,-,x and =. And pressing the space bar to submit the equation. The player can see which numbers they clicked on in the terminal. The terminal also says whether the equation is correct, incorrect, or already used and displays the points the player earned.

The second version moved the operators and submit button onto the game screen so they could be clicked on and the player could avoid using the keyboard.

These first two versions of the game were postfixed. Postfix notation places the operator after the two numbers (ex. 3,3,+,=,6). This type of notations is better suited to Python programming, because Python is a string based language.

The next version used infix notation. Infix notation is the way humans are used to viewing their equations. The operation is inbetween the numbers that are being operated on (ex. 3+3=6).

The current game shows all of the information in the game window. This makes the program much more intuitive and simple to use. The user can view the equation they are currently working on at the bottom of the history box. The player can view his or her past equations at the top of the box, including the points he or she earned for the equation. The feedback is printed in the bottom of the history box, replacing the current equation.


Object: Create as many equations as possible
How to Play:
1. Click on the first number in your equation. It will be outlined in blue. Click again to unselect it.
2. Click the operation you want to use.
3. Click on the next number. It must be in an adjacent square.
4. Repeat until completed.
5. Click Submit. This will test if your equation is correct.


This is the code for my postfixed program and my infixed program.
Here is the code for my newest update.
To use this program, right click on the link and click save as. You need Python and OpenGL to run the program.

My portfolio from last year can be found here .