On the Raspbian desktop you'll find an icon with the Python logo labelled Python Games
:
Double click this icon to start. This will prompt you to set your audio configuration to output sound over HDMI or the headphone jack. Make a selection or leave it as it is and click OK
to proceed.
Now you'll be shown a tall window with the list of games available:
Pick a game, click it and hit OK
to play.
The source of each of these games is available on the Pi. Simply navigate to the directory /home/pi/python_games
in a terminal or the file manager and you'll see the assets and source code.
The python_games
directory listing in a terminal window:
The python_games
folder contents in a the file manager window:
The Python source code for the Four in a Row game, open for editing in IDLE
.
You can edit the source of these games. Why not make a copy of a Python file, look through the code and change some numbers? See what happens.
If you can figure out how the game works, try to hack it to make it better, make it harder (or easier) to win, or add some features to the game! You could add GPIO interaction so lights flash when you win, or add input buttons.