Hi Nick @stoochie ! It looks like you tried to do the right thing to format your code when you pasted it into the post, but it didn’t quite work out. Try like this: Edit your post and delete all the code that is there Put the cursor on a new blank line Look in the editing toolbar above the editin… Answer from flyinghyrax on discuss.python.org
🌐
IDTech
idtech.com › blog › easy-games-to-make-in-python
9 Cool & Easy Games to Make in Python (And Starter Code for Beginners)
March 27, 2024 - So, grab your code editor (we use PyCharm), and let’s dive into the world of Python game development! A simple game where the computer picks a random number, and the player tries to guess it.
🌐
GitHub
gist.github.com › wynand1004 › ec105fd2f457b10d971c09586ec44900
A Simple Snake Game made in Python 3 · GitHub
Nice game, you can create classes for the snake body, scoreboard, food and maybe wall. Then the code will be more structured :) ... /bin/python3 "/home/devil/Code/Python/Turtle/Snake Game/snake_game.py" Traceback (most recent call last): File "/home/devil/Code/Python/Turtle/Snake Game/snake_game.py", line 4, in <module> import turtle File "/usr/lib/python3.10/turtle.py", line 107, in <module> import tkinter as TK ModuleNotFoundError: No module named 'tkinter'
Discussions

Coding a simple fishing game, logic being ignored (EDITED)
Hi friends, your help would be much appreciated with this one sorry in advance if i am not asking for help in the right way or have not formatted this document correctly, its my first time asking for help, please bear with me. 😀 the ‘if statement’ with asterixs ** before it is being ... More on discuss.python.org
🌐 discuss.python.org
4
0
October 9, 2023
Beginner wants to learn Python to make simple games – where to start?
Hello everyone, I am a 14-year-old student and just started learning Python. I have a dream of working at NASA, so I want to learn programming soon. Currently, I want to make a simple game in Python, for example a meteor shooting game or a gravity simulation between planets. More on discuss.python.org
🌐 discuss.python.org
1
2
August 6, 2025
What are the biggest ever games made with Python and/or Pygame?
The only major one I've heard is Eve Online. "Both the server and the client software for Eve Online are developed in Stackless Python, a variant of the Python programming language." wikipedia I would guess Python is a good choice for the many nested UI widgets in the game each with custom logic and formatting, using DirectX for the actual pretty graphics. More on reddit.com
🌐 r/Python
98
330
August 14, 2022
Simple snake game in Python - Code Review Stack Exchange
I have created a snake game in Python. It is a single-player game, where the snake has to eat the red dots in order to grow longer. I just wanted to review if there are any improvements. import tur... More on codereview.stackexchange.com
🌐 codereview.stackexchange.com
June 30, 2021
🌐
Reddit
reddit.com › r/learnpython › 101 python basic games
r/learnpython on Reddit: 101 Python BASIC Games
September 23, 2024 -

Hi there learnpython!

Just wanted to post an update on a project that I'm working - refactoring old BASIC games into modern Python. I've added 2 new games - Aceyducey, a simple card game and Amazing - a random maze generator which I've refactored into a simple CLI tool. If anyone has any comments or suggestions how to improve the code, that would be greatly appreciated.
In particular I'm unsure if there is a way to know if the approach used to generate a random maze in Amazing will always lead to a maze that is solvable? I've added the exit in a random location in the final row but haven't tested if that position can be visited from the entrance - I believe this would require representing each position in the maze as a node but I tried to follow the approach listed in the original source code.

Thanks for reading!

https://github.com/ctosullivan/Python-101-BASIC-Games

Top answer
1 of 5
7
Nice! I think my dad used to have one of these books (for ZX Spectrum). I think you should avoid having executable code on the level of the module (e.g. parser = argparse.ArgumentParse ) - put it in main() and run it if __name__ == "__main__": Try to avoid using global. Perhaps refactor your code to use classes, and one of these classes could store the whole state of the game (= the maze, counters...), and be passed around. Unfortunately, verifying if your maze-generation algorithm works would take too much time :( I don't think you need to guarantee that each cell of the grid is reachable, just if you can reach the exit starting from the entrance (one of entrances?) using Depth-First-Search. But if you can't, then what? Will you break some random walls and check again? Or regenerate the whole maze from scratch? Even if your maze is stored in a 2-dimensional char array with # as walls and spaces as rooms, it can still be treated as a graph and be eligible for standard traversal algorithms - it's just a different representation of graph nodes.
2 of 5
6
Cool project. If I may suggest one thing and honestly my skill level is middle so maybe you already have one and I just lack the ability to properly identify it, but I’d suggest putting a main() function in your classes or ideally one main class, rather than calling the required functions at the bottom of the script. Just makes readability a bit easier in my opinion. Cool project I look forward to checking a few out when I have time!
🌐
AskPython
askpython.com › python › examples › easy-games-in-python
Easy Games in Python - AskPython
April 20, 2026 - You can start with text-based games using only print() and input(), then move to graphical games using the built-in turtle module or install pygame via pip install pygame. A number guessing game or a Quiz Game are the easiest starting points.
🌐
CodeCombat
codecombat.com
CodeCombat: Learn to Code by Playing a Game
Learn programming with a multiplayer live coding strategy game for beginners. Learn Python or JavaScript as you defeat ogres, solve mazes, and level up. Open source HTML5 game!
🌐
Grant Jenks
grantjenks.com › docs › freegames
Free Python Games — Free Python Games 2.5.3 documentation
The copy command will create a Python file in your local directory which you can edit. For example, to copy and play the “snake” game run: $ python3 -m freegames copy snake $ python3 snake.py · Python includes a built-in text editor named IDLE which can also execute Python code.
Find elsewhere
🌐
Anirudh Jayaraman
pythonandr.com › 2015 › 05 › 16 › code-for-my-first-text-based-game
Code for my First Text-Based Game – Anirudh Jayaraman
July 6, 2015 - You can simply copy the code below into a text file, naming it something like game.py and save it to your home directory or wherever you wish to and run game.py from. Then from Terminal (CMD for Windows), type in python game.py.
🌐
Python.org
discuss.python.org › python help
Coding a simple fishing game, logic being ignored (EDITED) - Python Help - Discussions on Python.org
October 9, 2023 - Hi friends, your help would be much appreciated with this one sorry in advance if i am not asking for help in the right way or have not formatted this document correctly, its my first time asking for help, please bear with me. 😀 the ‘if statement’ with asterixs ** before it is being ignored (it is the first staement inside the still fishing while loop) I have tried re arranging the order of the if statements my code does not realise that I have added a catch to my esky. it will no...
🌐
Medium
medium.com › @marsmans › beginner-python-game-2f322dfc6bef
Build A Game In Python — For Beginners | by Sam Marsman | Medium
February 5, 2023 - Start by writing a statement describing the game — this will be printed when the game is run. print("Guess a number between 1 and 100. I'll tell you if the number I chose is lower or higher than your guess.") print is a built-in python method that displays text in the terminal. We need to declare some variables now. One variable is needed to hold the value of the random number that the code will generate.
🌐
Python.org
discuss.python.org › python help
Beginner wants to learn Python to make simple games – where to start? - Python Help - Discussions on Python.org
August 6, 2025 - Hello everyone, I am a 14-year-old student and just started learning Python. I have a dream of working at NASA, so I want to learn programming soon. Currently, I want to make a simple game in Python, for example a meteo…
🌐
Pygame
pygame.org › news
pygame news
Over the next weeks we have plenty of game jams that people from the pygame communities take part in. The pygames hackathon runs from March 20th, 2023 to April 17th 2023, and is open to people in USA and Canada. For this one there's $12,700 in prizes. "If you love programming and gaming, this is the perfect opportunity to showcase your skills and have some fun!" Then the must-use-python PyWeek challenge "Invites entrants to write a game in one week from scratch either as an individual or in a team.
🌐
Reddit
reddit.com › r/python › what are the biggest ever games made with python and/or pygame?
r/Python on Reddit: What are the biggest ever games made with Python and/or Pygame?
August 14, 2022 - That's not the actual code, its just a quick remake of it in python for demonstration sake (hence why its titled 'pseudocode') ... Probably Doki Doki Literature Club. It's made witn RenPy as are almost all visual novels. ... man that's really hard to pin down because most games aren't just made in one thing, their made of many components some of which might be python, some of which are other things.
🌐
Micro:bit Educational Foundation
microbit.org › code-ai
Code & AI with the micro:bit
There’s a huge community of people making tools for programming and interacting with the micro:bit which means you can program your micro:bit in Python, C++ and other languages, including other block editors.
🌐
Pygame
pygame.org › tags › all
all
Full-featured game console based on pygame that can be integrated in your python game in order to execute python command/scripts/custom in-game functions, pip install pgconsole · Pygame-BitmapFont provides a simple way to load and render text using pre-rendered bitmap font images and associated font data files.
🌐
Csforall
csforall.org › en-US › activities › hour-of-ai
Hour of AI Activities
Explore free Hour of AI activities. From lessons to hands-on projects, anyone can dive into AI learning with fun, accessible experiences.
🌐
DEV Community
dev.to › unitybuddy › 5-python-games-with-source-code-3g2b
5+ Python Games With Source Code - DEV Community
October 24, 2021 - We use tkinter for this and it is very simple! ... Caterpillar game with python you need to develop a logic in which you will use the four arrow keys to move around the caterpillar to make it eat the leaf, every time it eats the leaf it will grow bigger and move around faster.
Top answer
1 of 1
3

UX

It is not obvious what the user should do when the GUI opens up. You should display some simple instructions in the GUI, such as:

Use arrow keys on keyboard to move right, left, etc.

When I exit out of the GUI window, I see several errors in the shell in which I ran the game. Perhaps this is specific to the version of Python I am using.

Efficiency

In the snake_move function, the 4 if statements should be combined into a single if/elif because the 4 conditions are mutually exclusive:

def snake_move():
    if snake.direction == "up":
        y = snake.ycor()
        snake.sety(y + 20)
    elif snake.direction == "down":
        y = snake.ycor()
        snake.sety(y - 20)
    elif snake.direction == "left":
        x = snake.xcor()
        snake.setx(x - 20)
    elif snake.direction == "right":
        x = snake.xcor()
        snake.setx(x + 20)

You should also be able to eliminate the intermediate variables. For example:

    if snake.direction == "up":
        snake.sety(snake.ycor() + 20)

Magic number

The 20 in the snake_move function should be a declared constant. You should also add a comment describing why you chose this value.

DRY

The 4 functions:

def snake_go_up():
def snake_go_down():
etc.

could be combined into a single function with an argument passed in corresponding to the direction.

This group of lines is repeated twice:

time.sleep(1)
screen.clear()
screen.bgcolor('turquoise')
scoring.goto(0,0)
scoring.write("   GAME OVER \n Your Score is {}".format(score),align="center",font=("Courier",30,"bold"))

They can be placed into a function.

Layout

Move the functions to the top after the import lines. Having them in the middle of the code interrupts the natural flow of the code (from a human readability standpoint).

There is inconsistent whitespace around operators, such as

            a= snake.xcor()
            b = snake.ycor()

The black program can be used to automatically format the code to add consistency. This will also help with the inconsistent indentation and excessive blank lines.

🌐
Real Python
realpython.com › tutorials › gamedev
Python Game Development: Tutorials & Code Examples – Real Python
Tutorials and code examples for building Python games. Learn Pygame, Arcade, and more, from simple 2D projects to AI-powered game logic.
🌐
CodeWizardsHQ
codewizardshq.com › home › all articles › python games for kids to code
10 Python Games for Kids to Code | Learn Python Coding
June 2, 2025 - The game itself only explores basic Python concepts like setting variables and generating random integers. Also, the Python code is very well documented in this tutorial. The code for the Pig Dice game doesn’t need elements from any external libraries, either.