Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Dialogic | 2,547 | 13 hours ago | 138 | mit | GDScript | |||||
💬 Create dialogs, characters and scenes to display conversations in your Godot games. | ||||||||||
Termloop | 1,220 | 1 | 2 years ago | April 22, 2023 | 5 | other | Go | |||
Terminal-based game engine for Go, built on top of Termbox | ||||||||||
Pythonstdiogames | 596 | 2 years ago | 12 | December 30, 2020 | 5 | mit | Python | |||
A collection of text-based games written in Python 3 that only use "standard i/o". | ||||||||||
Godot 3d Mannequin | 513 | 2 years ago | 10 | other | C# | |||||
An Open Source 3d character and character controller for the Godot game engine | ||||||||||
Openmu | 506 | 19 days ago | 17 | mit | C# | |||||
This project aims to create an easy to use, extendable and customizable server for a MMORPG called "MU Online". | ||||||||||
Legend Wings | 457 | 6 years ago | Swift | |||||||
iOS Swift Game - Push SpriteKit to the limit | ||||||||||
Pokemon Font | 439 | 3 years ago | January 18, 2017 | ofl-1.1 | CSS | |||||
GAME BOY font from Pokémon R/G/B/Y/G/S/C, Unicode extended. | ||||||||||
Rpg Core | 437 | 4 months ago | 1 | other | C# | |||||
UNITY engine RPG framework | ||||||||||
Ipokemon | 428 | 7 years ago | 9 | mit | Objective-C | |||||
PokéMon like game on iOS with Location Based Service. | ||||||||||
Dnd Tldr | 410 | 3 years ago | 9 | cc-by-sa-4.0 | ||||||
Dungeons and Dragons - Too Long; Didn't Read |
A collection of Python 3 source code for simple, text-based games & simulations to use as example programs.
INSTALL: pip install --user gamesbyexample
(Use pip3
on macOS and Linux.)
RUN LAUNCHER: python -m gamesbyexample
I'm not accepting pull requests currently, but feel free to leave comments or send suggestions to [email protected]
If you need help installing Python, visit https://installpython3.com/
After beginners learn the syntax of Python and basic programming concepts (loops, branching, functions, etc.) they often hit a dead-end: "How do I become better at programming?" At this point, people will tell them to work on their own practice projects (which leaves them without guidance on what to make and how to make it) or to contribute to open source projects (which can be difficult to find, understand its code base, and get guidance on how to contribute).
What helped me learn to code was finding small projects whose source code I copied and then made small adjustments to. This gave me insight on how loops, branching, and functions combined together into actual programs.
To help others down the same path, I'm creating a collection of example programs aimed at being easy to copy and understand by beginners. These programs (mostly games) have the following constraints:
print()
and input()
in Python. The output being in the same text medium as the text source code makes it less abstract, and easier to see the cause-effect relationship between code and output. This means there's no graphics or mouse input, but makes it simple to port these programs to other languages since they all support stdio text.
input()
means the program must wait for the user to enter text, but this means we can't have real-time programs that respond to single key-presses.
help()
function to work in the interactive shell.
Additional guidelines include:
bext
module, which adds curses-like features like color, clearing the screen, and moving the cursori
and j
, or x
and y
.# EXPERIMENT!
that describe minor changes that they can make (increasing health, changing difficulty, etc.)assert
statements to catch common typos the student makes when typing in the code, especially for constants that they may modify.input()
, but note that you'll never be able to interrupt when the user is typing.
pyperclip
module can be used to interact with the clipboard. Large amounts of text can be input-ed into or output-ed from the program using the clipboard.
After making several of these programs, I've notice various "categories" of program complexity. Programs can be of zero or more of these categories:
bext
module, but can clear/refresh the screen, draw at arbitrary places on the screen in color, etc.
input()
, the user edits variables at the top of the file to change the settings in the program.
Additional modules I recommend using:
bext
for colorful text and controlling the positioning of the text cursor.blessings
for a better version of curses.pyperclip
for copying/psating text with the clipboard.playsound
for playing sound files.pyttsx3
for text to speech.pytextcavas
for 2D strings you can draw onpyrect
for rectangle data structurepybresenham
for various line-drawing functionsAlphabetize Quiz - A time-based quiz game to see how fast you can alphabetize letters.
Alphabetize Word Quiz - A time-based quiz game to see how fast you can alphabetize words.
Analog Clock - An analog clock animation. Press Ctrl-C to stop.
Bagels - A deductive logic game where you must guess a number based on clues.
Birthday Paradox Simulation - Explore the mathematics of the "Birthday Paradox". More info at https://en.wikipedia.org/wiki/Birthday_problem
Blackjack - A card game also known as 21. More info at: https://en.wikipedia.org/wiki/Blackjack
Bouncing Ball - A bouncing ball animation. Press Ctrl-C to stop.
Bouncing Lines - A bouncing line animation. Press Ctrl-C to stop.
Calendar Maker - Create monthly calendars, saved to a text file and fit for printing.
Chance Checkers - Checkers, but you can move 3 random checkers per turn. These checkers are randomly decided, and can be the player's own checkers or their opponents', but you can't move your opponents' promoted checkers. In this version, capturing is not mandatory.
Daleks - Try to get the robots to crash into each other.
Checkers - The classic checkers board game. In this version, capturing is not mandatory.
Chomp - A dangerously delicious logic game. Inspired by a Frederik Schuh and David Gale puzzle, published by Martin Gardner in Scientific American (January 1973) More info at: https://en.wikipedia.org/wiki/Chomp
Clickbait Headline Generator - A clickbait headline generator for your soulless content farm.
Coin Flip Simulator - Simulate a large number of coin flips.
Collatz Sequence - Generates numbers for the Collatz sequence, given a starting number.
Collatz Sequence Stats - Finds out how long various Collatz Sequences are.
Connect Four - A board game to get four tiles in a row.
Conway's Game of Life - The classic cellular automata simulation. Press Ctrl-C to stop. More info at: https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
Conway's Game of Life (Terminal) - The classic cellular automata simulation. Press Ctrl-C to stop. More info at: https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
Countdown - Show a countdown timer animation using a seven-segment display. Press Ctrl-C to stop. More info at https://en.wikipedia.org/wiki/Seven-segment_display Requires our sevseg.py program.
Diagonal Maze - Prints out a random, diagonal maze. Inspired by the 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 program.
Dice Roller - Simulates dice rolls using the Dungeons & Dragons notation.
Digital Clock - Display a digital clock of the current time with a seven-segment display. Press Ctrl-C to stop. More info at https://en.wikipedia.org/wiki/Seven-segment_display Requires our sevseg.py program.
DNA - A simple animation of a DNA double-helix. Press Ctrl-C to stop. Thanks to matoken for inspiration: https://asciinema.org/a/155441
Eeny-Meeny-Miny-Moe - An elimination game for multiple players. Press Ctrl-C to stop. More info at https://en.wikipedia.org/wiki/Eeny,_meeny,_miny,_moe More info at https://en.wikipedia.org/wiki/Josephus_problem
Etch a Sketch - Draw a trailing line on the screen.
Factorization - Find all the factors of a number.
Fireflies - A beautiful animation of fireflies. Press Ctrl-C to stop.
Fish Tank - A peaceful animation of a fish tank. Press Ctrl-C to stop.
FizzBuzz Calculation - Calculates the answers for the fizz buzz programming problem.
FizzBuzz Game - A number game where you also race against the clock.
Flippy (a Reversi clone) - (Requires Pygame) Play against the computer and try to flip their tiles.
Flood Fill - An example of a "flood fill" algorithm. This is a basic demo of both the recursive and iterative floodfill algorithms. This algorithm is commonly used in "fill tools" in graphics programs like MS Paint or Photoshop. This algorithm is also used in the floodit.py game.
Flood It! - A colorful game where you try to fill the board with a single color.
Forest Fire Sim - A simulation of fires spreading in a growing forest. Press Ctrl-C to stop. Inspired by Nicky Case's Emoji Sim http://ncase.me/simulating/model/
Four-In-A-Row - (Requires Pygame) Play against the computer, dropping tiles to connect four.
Nonuniform Fractal Tree Drawer - Draws nonuniform fractal trees with turtle graphics.
Fractal Tree Drawer - Draws fractal trees with turtle graphics.
2048 Game - A sliding tile game to combine exponentially-increasing numbers. Inspired by Gabriele Cirulli's 2048, which is a clone of Veewo Studios' 1024, which in turn is a clone of the Threes! game. More info at https://en.wikipedia.org/wiki/2048_(video_game)
Gemgem (a Bejeweled clone) - (Requires Pygame) An addictive jewel matching game.
Ghost Leg Lottery - Follow the trail to see who wins! More info at: https://en.wikipedia.org/wiki/Ghost_Leg
Guess the Number - While given hints, try to guess the secret number.
Guillotine - A French variant of Hangman with different graphics. Ooh la la!
Hacking - The hacking mini-game from "Fallout 3".
Hammurabi - The classic game Hamurabi.bas by Doug Dyment, popularized by David Ahl.
Hamsburger - A program for making silly pluralizations. Press Ctrl-C to stop.
Hangman - A word-guessing game.
Hangman with Random Letters - A completely unfair word-guessing game. (This is a joke program.)
Hard-coded Tic Tac Toe - Play tic tac toe against the computer. Every possible move has been hard-coded into this program. The program is 5700 lines long. This is a joke program, don't actually write code like this.
Hilbert Curve - Draws the Hilbert Curve fractal with turtle graphics. More info at: https://en.wikipedia.org/wiki/hilbertCurve Good videos on space-filling curves: https://youtu.be/RU0wScIj36o and https://youtu.be/3s7h2MHQtxc
Hour Glass Animation - An animation of an hour glass filled with falling sand. Press Ctrl-C to stop.
Idiot - How to keep an idiot busy for hours. (This is a joke program.)
Ink Spill (a Flood It clone) - (Requires Pygame) Try to make the entire field a single color.
J'ACCUSE! - A mystery game of intrigue and a missing cat. Inspired by Homestar Runner's "Where's an Egg?" game
Koch Snowflake - Draws a Koch snowflake fractal with turtle graphics.
Langton's Ant - A cellular automata animation. Press Ctrl-C to stop. More info: https://en.wikipedia.org/wiki/Langton%27s_ant
Lawnmower - Watch grass get cut and grow again. Press Ctrl-C to stop. Inspired by Tondeuse by Jules Villard, https://asciinema.org/a/21743 https://bitbucket.org/jvillard/tondeuse/src/default/
Leetspeak - Translates English messages into l33t5p34]<.
Luhn Checksum Algorithm - The mathematics behind credit card numbers. More info at: https://en.wikipedia.org/wiki/Luhn_algorithm More info at: https://youtu.be/Erp8IAUouus
Magic Eight Ball - Ask a question about your future.
Magic Hexagon - Place numbers in a hexagon so each row adds up to 38. More info at https://en.wikipedia.org/wiki/Magic_hexagon More info at https://www.youtube.com/watch?v=ZkVSRwFWjy0
Mancala - The ancient seed-sowing board game. Rules at http://www.mancalarules.com/ More info at https://en.wikipedia.org/wiki/Mancala
Matching Parentheses - A parentheses/bracket/braces matching algorithm.
Maze Maker - Make mazes with the recursive backtracker algorithm. More info at: https://en.wikipedia.org/wiki/Maze_generation_algorithm#Recursive_backtracker An animated demo: https://scratch.mit.edu/projects/17358777/
Maze Runner - Move around a maze and try to escape.
Maze 3D - Move around a maze and try to escape... in 3D!
Maze Runner HTML - Move around a maze and try to escape... in 3D and IN YOUR WEB BROWSER!
Memory Puzzle - (Requires Pygame) A simple memory matching game.
Middle Letter Scrambler - Scrambles the middle letters of words, but not the first and last letters.
Million Dice Roll Stats - A simulation of one million dice rolls.
Mona Lisa - Draws an Andy Warhol-like drawing of the Mona Lisa with turtle graphics.
Mondrian Art Generator - Randomly generates Mondrian-style art.
Monty Hall Problem - A simulation of the Monty Hall game show problem. More info at https://en.wikipedia.org/wiki/Monty_Hall_problem
Morse Code - Translates between English and Morse Code. More info at: https://en.wikipedia.org/wiki/Morse_code
Multiplication Table - Print a multiplication table.
Multiplicative Persistence - A fun math challenge. For more information about this topic, see https://youtu.be/Wim9WJeDTHQ
99 Bottles of Beer on the Wall - Print the full lyrics to one of the most longest songs ever! Press Ctrl-C to stop.
Peg Solitaire - A single-player, peg-jumping game to eliminate all the pegs. More info at https://en.wikipedia.org/wiki/Peg_solitaire
Pentomino - (Requires Pygame) Like Pygame, except with 5-box blocks.
Periodic Table of Elements - Displays atomic information for all the elements.
Pig Latin - Translates English messages into Igpay Atinlay.
Polygons - A turtle program to draw polygons. Every line is the same length.
Progress Bar - A sample progress bar animation that can be used in other programs.
Pythons - Drawing pythons with turtle graphics.
Rail Fence Cipher - The "rail fence" cipher for encrypting text. More info at: https://en.wikipedia.org/wiki/Rail_fence_cipher
Rainbow - Shows a simple rainbow animation. Press Ctrl-C to stop.
Rainbow 2 - Shows a simple squiggle rainbow animation. Press Ctrl-C to stop.
Random Walk - Generate splatter-art with the "random walk" algorithm. Press Ctrl-C to stop. More info at: https://en.wikipedia.org/wiki/Random_walk
Reversi - A tile flipping game, also called reversi. More info https://en.wikipedia.org/wiki/Reversi
Rock-Paper-Scissors - A hand game of luck.
Rock-Paper-Scissors (Always Win) - A hand game of luck, except you cannot lose.
ROT13 Cipher - The simplest cipher for encrypting and decrypting text. More info at https://en.wikipedia.org/wiki/ROT13
Rotating Cube - A rotating cube animation. Press Ctrl-C to stop.
Rotating Cube (Bext Version) - A rotating cube animation. Press Ctrl-C to stop.
Rotating Sphere - A rotating sphere animation. Press Ctrl-C to stop.
Rush Hour - A sliding tile puzzle game to move cars out of the way. Original game by Nob Yoshihagara More info at https://www.michaelfogleman.com/rush/
Sand Fall - A falling sand animation. Inspired by https://asciinema.org/a/6515
Sand Fall (Bext Version) - A falling sand animation. Inspired by https://asciinema.org/a/6515
Sevseg - A seven-segment display module. More info at https://en.wikipedia.org/wiki/Seven-segment_display
Shell Game - A random gambling game.
Sierpinkski's Game - Sierpinkski's "game" is an algorithm that draws Sierpinski's Triangle with turtle graphics. More info at https://en.wikipedia.org/wiki/Chaos_game
Sierpinski Square - Draws the Sierpinski Square (also called Carpet) with turtle graphics. More info at: https://en.wikipedia.org/wiki/Sierpinski_carpet
Sierpinski Triangle - Draws the Sierpinski Triangle fractal with turtle graphics.
Simulate (a Simon clone) - (Requires Pygame) Copy the pattern of flashing lights for as long as possible.
Slide Puzzle - (Requires Pygame) The classic 15-tile slide puzzle.
15-Sliding Puzzle - Slide the numbered tiles into the correct order.
Snail Race - Fast-paced snail racing action!
Sokoban clone - The classic crate-pushing game.
Sonar Treasure Hunt - Try to locate treasure chests hidden under the waves.
Soroban - A simulation of a Japanese abacus calculator tool. More info at: https://en.wikipedia.org/wiki/Soroban
Spiral - Draws a simple square spiral.
sPoNgEtExT - Translates English messages into sPOnGEtExT.
Squirrel Eat Squirrel - (Requires Pygame) A game where squirrels eat each other and grow monstrously large.
Star Pusher (a Sokoban clone) - (Requires Pygame) A puzzle game where you push the stars over their goals.
Sticky Hands - A jewel-stealing, movement puzzle game.
Sudoku - The classic 9x9 number placement puzzle. More info at https://en.wikipedia.org/wiki/Sudoku
Tetromino (a Tetris clone) - (Requires Pygame) The classic block falling puzzle from the Soviet Union.
Tetromino for Idiots - (Requires Pygame) Tetris, but... simpler.
Three-Card Monte - Find the Queen of Hearts after cards have been swapped around. (In the real-life version, the scammer palms the Queen of Hearts so you always lose.) More info at https://en.wikipedia.org/wiki/Three-card_Monte
Tic Tac Toe - The classic board game.
Tic Tac Toe (OOP) - The classic board game. (Object-oriented programming version.)
Towers of Hanoi puzzle - A puzzle where you must move the discs of one tower to another tower. More info at https://en.wikipedia.org/wiki/Tower_of_Hanoi
Ulam Spiral - The Ulam spiral is a mysterious mathematics pattern for prime numbers with turtle graphics. More info at https://en.wikipedia.org/wiki/Ulam_spiral
Water Bucket Puzzle - A water pouring puzzle. More info: https://en.wikipedia.org/wiki/Water_pouring_puzzle
Wormy - (Requires Pygame) Lead the green snake around the screen eating red apples.
Zigzag - A simple zig zag animation. Press Ctrl-C to stop.