Skip to content

The classic 2048 game developed by Gabriele Cirulli recreated in pure Python with an Expectimax autosolver.

License

Notifications You must be signed in to change notification settings

vSparkyy/2048-Expectimax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2048-Expectimax

The classic 2048 game developed by Gabriele Cirulli recreated in pure Python with pygame with an Expectimax autosolver. (with smooth animations too :D)

Features

  • Interactive Sliding Tiles: Move tiles manually with the arrow keys.
  • Live Expectimax* Solver: Press "S" to let the solver predict the best moves, and watch it live!
  • Animated Moves: Watch each tile slide smoothly and pop just like the original web game!
  • Easy Reset: Press "R" to reset the grid and your score
  • Customisable Depth: Simply change the max depth in solver.py

Dependencies

  • Python 3.x
  • Pygame

Getting Started

  1. Head over to the releases page

    • Download the source code of the latest release.
    • Install the required dependencies using pip:
      pip install pygame
    • Extract the contents of the file and run the main.py script to start the application.
  2. OR clone the repository to your local machine:

    git clone https://github.com/vSparkyy/2048-Expectimax.git
    • Install the required dependencies:
      pip install pygame
    • Run the main.py script:
      python main.py
  3. OR press the green '<> Code' button and download the ZIP file:

    • Extract the contents of the ZIP file into one folder.
    • Run the main.py script to start the application.

Usage

  • Arrow Keys: Move all tiles up, down, left, or right (if they can!).
  • R: Reset the grid to its starting position.
  • S: Toggle the Expectimax solver, press again to disable.
  • Q: Continue the game if won already.
  • Live Solving Animation: As the solver predicts the best moves, you can watch it seamlessly merge tiles live!

Credits

  • Made by Harshil (vSparkyy)
  • Fonts used: Montserrat Regular & Bold
  • Inspired by the classic 2048 web game.

Contributing

Contributions are welcome! If you find any issues or want to add more features, feel free to create a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

The classic 2048 game developed by Gabriele Cirulli recreated in pure Python with an Expectimax autosolver.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages