Skip to content

Mini-games in python via Jupyter Notebook or similar.

License

Notifications You must be signed in to change notification settings

ps4449/python-games

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Games in Python

A collection of classic board and card games built in Python to explore different libraries and concepts.

Games

Game Status UI
Rock Paper Scissors Complete Web
Mastermind Complete Web
Tic Tac Toe Complete Web
Snake Complete Pygame
War Complete Web
Blackjack In Progress Web
Tic Tac Toe (AI) Planned Web
Game of Life Planned TBD

Architecture

┌─────────────────────────────────────────────┐
│              Frontend (Browser)              │
│         HTML / CSS / JavaScript              │
└─────────────────┬───────────────────────────┘
                  │ API calls (JSON)
                  ▼
┌─────────────────────────────────────────────┐
│          Python Backend (Flask)              │
│            All game logic here               │
└─────────────────────────────────────────────┘
  • Web Games: Flask backend serves game logic via API, frontend handles rendering and user interaction
  • Snake: Standalone Pygame application with graphics and audio

Folder Structure

python-games/
├── app.py                  # Flask application entry point
├── requirements.txt        # Python dependencies
├── README.md
│
├── games/                  # Game logic modules
│   ├── __init__.py
│   ├── rps.py              # Rock Paper Scissors
│   ├── tictactoe.py        # Tic Tac Toe
│   ├── mastermind.py       # Mastermind
│   ├── war.py              # War (card game)
│   └── blackjack.py        # Blackjack
│
├── static/                 # Frontend assets
│   ├── css/
│   │   └── style.css
│   ├── js/
│   │   ├── rps.js
│   │   ├── tictactoe.js
│   │   ├── mastermind.js
│   │   ├── war.js
│   │   └── blackjack.js
│   └── images/
│
├── templates/              # HTML templates
│   ├── base.html           # Base template
│   ├── index.html          # Home page (game selection)
│   ├── rps.html
│   ├── tictactoe.html
│   ├── mastermind.html
│   ├── war.html
│   └── blackjack.html
│
└── snake_game/             # Standalone Pygame game
    ├── main.py
    └── resources/
        ├── apple.jpg
        ├── block.jpg
        ├── bg.jpg
        ├── bg_music_1.mp3
        ├── ding.mp3
        └── crash.mp3

Running the Games

Web Games

pip install -r requirements.txt
python app.py
# Open http://localhost:5000 in your browser

Snake (Pygame)

cd snake_game
pip install pygame
python main.py

Tech Stack

  • Backend: Python, Flask
  • Frontend: HTML, CSS, JavaScript
  • Snake Game: Python, Pygame

About

Mini-games in python via Jupyter Notebook or similar.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages