The Ladder Game- Hardware emulated in Python and C
|Prerequisites:||Basic Raspberry setup step by step|
|Refreshing the Software of the Raspberry Pi|
|Hardware:||Breadboard and Jumper cables or soldering equipment|
|12 LEDs of any color and fitting resistors|
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.
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.
Ladder Game installation
Clone the python code from GitHub onto the Raspberry Pi with
cd ~ git clone https://github.com/JoBergs/LadderGame.git
Start the game
cd ~/LadderGame/LadderGame sudo python ladder.py
For climbing the ladder, the pushbutton has to be pressed as precise as possible between the blinking intervals.
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.
For more detail: The Ladder Game- Hardware emulated in Python and C