About the Game
Tell the Truth! is a game that runs on a Raspberry Pi or other hardware. It simulates logic gates by randomly lighting up a grid of lamps in a specific pattern that represents the Truth Table of a particular gate e.g. AND, OR etc. The player has a short amount of time to recognise the pattern of lights and select the appropriate input. For example, in the truth table below the game has randomly generated an OR gate.
To make the game more interesting, rather than pressing buttons or keys to make the selection we use fresh fruit connected to a Makey Makey board; the board acts as a keyboard emulator and feeds player responses to the Raspberry Pi.
Where possible the name of the fruit should sound similar to the gate. So, use an ORange for the OR gate. (See what we did there!)
The game can be played at three different levels:
- Level 1 – The only combinations outputted are AND, OR, NAND, & NOR.
- Level 2 – Adds XOR & XNOR
- Level 3 – At level 2 there are six output combinations that represent a valid logic gate. Actually there are 24=16 possible combinations, i.e. there are 10 outputs that do not represent a gate – these are added at Level Three. Use one fruit to represent these ‘Gibberish’ outputs – we used a Grapefruit for Gibberish! (or you could use Rhubarb for Rubbish)
Tell the Truth! is written in Python and includes 872 lines of code. The code is shown below.
- The game uses music to signal if a correct response has been given.
- The game flashes the output lights randomly for a few seconds before presenting an output.
- In the Truth Table above columns A & B are inputs and so do not change. However, the gPiO box that drives the lights has six output channels, so to make the game more visually interesting we also flash columns A & B before returning them to the values in the table.