Greedy, Yet Intelligent, Algorithms for the Game 2048 Using Python
CSEF · 2019 Mathematical Sciences
Overview
Objectives The objective of this project is to design, implement, test, and analyze simple algorithms to find the one that can achieve the highest tiles in the Google Chrome Extension of the game 2048. Methods Materials/environment: iMac desktop computer, Python v3.5, Pycharm IDE, free open source packages OpenCV and PyAutoGUI, Google Chrome extensions 2048 by Moloko and Empty New Tab Page by [email protected]. Tested twelve self-programmed algorithms (including two baseline algorithms) 200 games each, outputting collected data to .csv files. Used Seaborn, MatPlotLib, Pandas, and NumPy libraries to help me graph and analyze data. Results The optimal algorithms are a combination of chain reaction movement and the reward function given parameter 1 as the additional score (search depth 2 steps). Of those, the algorithm with the highest tile of the future board as parameter 2 appears to perform the best, and can reach the winning state of 2048 6.5% of the time. Conclusions I programmed and analyzed different algorithms for the game 2048. The optimal algorithm appears to be a combination of chain reaction movement and the reward function given parameter 1 as the additional score and parameter 2 as the highest tile of the future board. This demonstrates that a simple intelligent algorithm can achieve a good result comparable to that of more complex algorithms, given the right constraints and parameters to compare.
Summary statement
I devised a simple algorithm that can achieve the winning state of 2048.
Help received
After learning techniques from internet searches and online courses, I programmed and tested the algorithm by myself.
Competition history
- CSEF 2019
Resources
Related projects
CSEF · 2012
Computer vs. Human: Exploring AI in the Game Blokus
CSEF · 2014
Game On: Creating a Worthy Connect Four Opponent with Heuristic Algorithms
CSEF · 2019
Creating a Neural Network to Play the Game of Connect Four Using a Genetic Algorithm
CSEF · 2010
Chess Algorithms
CSEF · 2011
Position or Piece: Computer Simulation and Study of the Strategy Board Game Blokus
CSEF · 2010
A. I. Connect-Four
CSEF · 2014
Constructing an Adaptive Blackjack Computer Program to Self-Improve Itself Based on Previous Performance
CSEF · 2008
Determining the Optimal Iterated Prisoner's Dilemma Strategy
Closest projects by meaning, across every fair and year in the corpus.
Browse more like this
Source: California Science & Engineering Fair public projects