2048 AI – The Intelligent Bot

Code My Road

Typical AI run Typical AI run

Introduction

In this article, we develop a simple AI for the game 2048 using the Expectimax algorithm and “weight matrices”, which will be described below, to determine the best possible move at each turn.

The implementation of the AI described in this article can be found here. The source files for the implementation can be found here.

Recursivity of score function

We define some symbols and functions in order to construct a function to compute the score of any one game state (i.e. grid).

  • Game state: A $latex 4 times 4$ square matrix $latex mathbf{A}$ where $latex mathbf{A}_{ij}$ is equal to the value of the cell in the game grid at row $latex i$ and column $latex j$.
  • $latex text{score}(mathbf{A})$ : The numerical score of the game state $latex mathbf{A}$.
  • $latex D_mathbf{A}$ : The set of possible move directions (up, down, left, right) for $latex mathbf{A}$.
  • $latex…

View original post 825 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s