This is a personal project to optimize an algorithm for playing the game 2048. So far, I've implemented a Monte Carlo search algorithm that utilizes the GPU of the user's computer to parallelize the simulations and thus run much faster.
2048AI/game_files/MonteCarloAI.py: Contains the main algorithm for the Monte Carlo search.2048AI/game_files/modules: Contains modules for running the aforementioned algorithm.2048AI/game_files/original: Contains original files from the course, and files for profiling the performance of an algorithm that doesn't utilize the GPU.
- Nvidia GPU and CUDA toolkit installed.
- Python 3.x
To run this project, you need to install the following Python packages:
pycuda: Access to Nvidia's CUDA parallel computation API from within Python.numpy: Package for scientific computing with Python.pygame: Set of Python modules designed for writing video games.
You can install the necessary Python packages using pip:
pip install pycuda numpy pygameMake sure the version of PyCUDA matches the version of your CUDA toolkit.
The code for the game itself Game2048.py and for playing it manually Play_Game2048.py was developed by DTU lecturers for the course "Introduction to Intelligent Systems" 02461, and has only been slightly modified by me. The rest is developed by me.