Skip to content

Python-based implementation of the classic 2048 puzzle game with a simple and interactive interface

Notifications You must be signed in to change notification settings

ajitashwath/2048-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Based 2048 Game

A modern implementation of the classic 2048 puzzle game built with Pygame. Challenge yourself to create the 2048 tile while enjoying features like score tracking, game statistics, and local high scores!

Features

  • 🎮 Smooth, responsive gameplay
  • 📊 Real-time score and moves tracking
  • ⏱️ Game duration monitoring
  • 🏆 Local high scores system
  • 💾 SQLite database for game statistics

Requirements

  • Python 3.8 or higher
  • Pygame
  • SQLite3 (included in Python standard library)

Installation

  1. Clone this repository:
git clone https://github.com/ajitashwathr10/2048-py.git
cd 2048-py
  1. Install the required dependencies:
pip install pygame
  1. Run the game:
python main.py

How to Play

  • Use arrow keys to move tiles (⬆️ ⬇️ ⬅️ ➡️)
  • When two tiles with the same number touch, they merge into one!
  • Create a tile with the number 2048 to win
  • Game over when no more moves are possible

Game Statistics

The game automatically tracks and stores:

  • Your score
  • Maximum tile achieved
  • Number of moves
  • Game duration

Database Structure

The game uses SQLite to store two types of records:

Games Table

  • Complete game sessions
  • Includes score, max tile, duration, and moves

Contributing

Feel free to contribute to this project! You can:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Acknowledgments

  • Original 2048 game by Gabriele Cirulli
  • Pygame community for the excellent game development library
  • Contributors and testers who helped improve this implementation

About

Python-based implementation of the classic 2048 puzzle game with a simple and interactive interface

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages