Tested on:Raspberry Pi 2; Raspberry Pi B+; Python 2.7; Raspbian pre Jessie
Prerequisites:Raspberry Pi with Raspbian Jessie and internet connection (see steps 1-7 in the Introduction)
Hardware:Breadboard and Jumper cables or soldering equipment
12 LEDs of any color and fitting resistors
1 Pushbutton

The Ladder Game- Hardware emulated in Python and C

The ladder game is a good project for getting warm with the Raspberry Pi: the breadboard is quickly assembled, soldering a permanent version makes no trouble and the game is installed and run with ease. Additionally, it’s a funny game in itself, so high reward/stress ratio, yay!

Gordon Henderson translated the hardware-based ladder game with a capacitor logic into a C version(see his great article about the ladder game on drogon.net) where only the interface(LED display and pushbutton) remains hardware. Herein, his C version translated into python code is presented.

Breadboard circuit

Breadboard Laddergame

Wiring diagram of the ladder game installed on a breadboard

The wiring looks confusing, but it’s quite simple actually. All LED cathodes are connected to the right minus line of the board, which is connected to pin 6(GND) as counted per board numbering. Connect the LED resistors from top to bottom to the pins 11, 12, 13, 15, 16, 18, 22, 7, 24, 26, 19, 21 and the button to pin 3.

Permanent circuit

The assembled circuit of the ladder game for Raspberry Pi

Permanent circuit of the ladder game

Ladder Game installation
Clone the python code from GitHub onto the Raspberry Pi with

Start the game

For climbing the ladder, the pushbutton has to be pressed as precise as possible between the blinking intervals. If the game should run with nothing but a power source, it needs to be autostarted. This is explained in the tutorial on shell aliasing and autostart.

The complete script
Click on Full Script to show all of the code.

Live action

Change difficulty
I lost, it’s not that easy! To change the difficulty, open ladder.py and find the line

Decreasing the value makes the game more easy.

Gordon Henderson Website: https://projects.drogon.net
Gordon Henderson's C Ladder Game: https://projects.drogon.net/raspberry-pi/gpio-examples/ladder-game
Shell alias tutorial: http://www.knight-of-pi.org/shell-alias-start-projects-on-the-raspberry-pi-after-booting/

Knight of Pi

Johannes Bergs aka Knight of Pi. Diploma in Bioinformatics, some Webdesign and Python coding then. Living in the beautiful city of Vienna.


Time limit is exhausted. Please reload CAPTCHA.