expectimax You merge similar tiles by moving them in any of the four directions to make "bigger" tiles. To run with Expectimax Agent w/ depth=2 and goal of 2048. I am not sure whether I am missing anything. 3 0 obj
The code starts by declaring two variables, r and c. These will hold the row and column numbers at which the new 2 will be inserted into the grid. The Expectimax search algorithm is a game theory algorithm used to maximize the expected utility. As far as I'm aware, it is not possible to prune expectimax optimization (except to remove branches that are exceedingly unlikely), and so the algorithm used is a carefully optimized brute force search. Either do it explicitly, or with the Random monad. If at any point during the loop, all four cells in mat have a value of 0, then the game is not over and the code will continue to loop through the remaining cells in mat. The code starts by importing the random package. Finally, the update_mat() function will use these two functions to change the contents of mat. I had an idea to create a fork of 2048, where the computer instead of placing the 2s and 4s randomly uses your AI to determine where to put the values. This is a constant, used as a base-line and for other uses like testing. This variant is also known as Det 2048. A single row or column is a 16-bit quantity, so a table of size 65536 can encode transformations which operate on a single row or column. I think I found an algorithm which works quite well, as I often reach scores over 10000, my personal best being around 16000. This process is repeated for every row in the matrix. The above heuristic alone tends to create structures in which adjacent tiles are decreasing in value, but of course in order to merge, adjacent tiles need to be the same value. The while loop is used to keep track of user input and execute the corresponding code inside it. 4. Building instructions provided. Just try to keep the top row filled, so moving left does not break the pattern), but basically you end up having a fixed part and a mobile part to play with. If you are not familiar with the game, it is highly recommended to first play the game so that you can understand the basic functioning of it. This is done by calling the start_game() function. The Best 9 Python 2048-expectimax Libraries term2048 is a terminal-based version of 2048., :tada: 2048 in your terminal, The Most Efficient Temporal Difference Learning Framework for 2048, A Simple 2048 Game Built Using Python, Simulating an AI playing 2048 using the Expectimax algorithm, Finally, both original grids and transposed matrices are returned. You can try the AI for yourself. <>
The implementation of the AI described in this article can be found here. Using 10000 runs gets the 2048 tile 100%, 70% for 4096 tile, and about 1% for the 8192 tile. The whole approach will likely be more complicated than this but not much more complicated. In testing, the AI achieves an average move rate of 5-10 moves per second over the course of an entire game. The tables contain heuristic scores computed on all possible rows/columns, and the resultant score for a board is simply the sum of the table values across each row and column. There was a problem preparing your codespace, please try again. Some of the variants are quite distinct, such as the Hexagonal clone. In particular, the optimal setup is given by a linear and monotonic decreasing order of the tile values. A fun distraction when you don't have time to aim for a high score: Try to get the lowest score possible. INTRODUCTION Game 2048 is a popular single-player video game released %PDF-1.3 In above process you can see the snapshots from graphical user interface of 2048 game. Next, if the user moves their finger (or swipe) up, then instead of reversing the matrix, the code just takes its transpose value and updates the grid accordingly. What is the best algorithm for overriding GetHashCode? To assess the score performance of the AI, I ran the AI 100 times (connected to the browser game via remote control). Below is the code implementing the solving algorithm. Includes an expectimax strategy that reaches 16384 with 34.6% success and an ML model trained with temporal difference learning. %
In deep reinforcement learning, we used sum of grid as reward and trained two hidden layers neural network. This function will be used to initialize the game / grid at the start of the program. Rest cells are empty. NBn'a[l=DE m W[tZy/[}QC9cDQ:u(9+Sqwx. Meanwhile I have improved the algorithm and it now solves it 75% of the time. This is useful for modelling environments where adversary agents are not optimal, or their actions are based on chance.Expectimax vs MinimaxConsider the below Minimax tree: As we know that the adversary agent(minimizer) plays optimally, it makes sense to go to the left. @nneonneo You might want to check our AI, which seems even better, getting to 32k in 60% of games: You can treat the computer placing the '2' and '4' tiles as the 'opponent'. Then return the utility for that state. <>
Inside the if statement, we are checking for different keys and depending on that input, we are calling one of the functions from logic.py. A state is more flexible if it has more freedom of possible transitions. 2048 game solved with Expectimax. x]7r}QiuUWe,QVbc!gvMvSM$c->(P%w$(
_B}x2oFauV,nY-] Nneonneo's solution can check 10millions of moves which is approximately a depth of 4 with 6 tiles left and 4 moves possible (2*6*4)4. The first heuristic was a penalty for having non-monotonic rows and columns which increased as the ranks increased, ensuring that non-monotonic rows of small numbers would not strongly affect the score, but non-monotonic rows of large numbers hurt the score substantially. Also, I tried to increase the search depth cut-off from 3 to 5 (I can't increase it more since searching that space exceeds allowed time even with pruning) and added one more heuristic that looks at the values of adjacent tiles and gives more points if they are merge-able, but still I am not able to get 2048. If it has not, then the code checks to see if any cells have been merged. I'd be interested to hear if anyone has other improvement ideas that maintain the domain-independence of the AI. I did find that the game gets considerably easier without the randomization. Expectimax Algorithm. Play as single player and see what the heuristics do, or run with an AI at multiple search tree depths and see the highest score it can get. By using our site, you endobj
=) That means it achieved the elusive 2048 tile three times on the same board. Jordan's line about intimate parties in The Great Gatsby? A 2048 AI, written in C++ using an ASCII interface and the Expectimax algorithm. The model the AI is trying to achieve is. The result is not satsified, the highest score I achieve is only 512. We also need to call get_current_state() to get information about the current state of our matrix. the entire board filled with 4 .. 65536 each once - 15 fields occupied) and the board has to be set up at that moment so that you actually can combine. In essence, the red values are "pulling" the blue values upwards towards them, as they are the algorithm's best guess. sign in Similar to what others have suggested, the evaluation function examines monotonicity . This presents the problem of trying to merge another tile of the same value into this square. Surprisingly, increasing the number of runs does not drastically improve the game play. The algorithm went from achieving the 16384 tile around 13% of the time to achieving it over 90% of the time, and the algorithm began to achieve 32768 over 1/3 of the time (whereas the old heuristics never once produced a 32768 tile). My solution does not aim at keeping biggest numbers in a corner, but to keep it in the top row. I think it will be better to use Expectimax instead of minimax, but still I want to solve this problem with minimax only and obtain high scores such as 2048 or 4096. This module contains all the functions that we will use in our program. The tree search terminates when it sees a previously-seen position (using a transposition table), when it reaches a predefined depth limit, or when it reaches a board state that is highly unlikely (e.g. Please I am a bit new to Python and it has been nice, I could comment that python is very sexy till I needed to shift content of a 4x4 matrix which I want to use in building a 2048 game demo of the game is here I have this function. (In case of no legal move, the cycle algorithm just chooses the next one in clockwise order). A tag already exists with the provided branch name. However, I have never observed it obtaining the 65536 tile. Then the average end score per starting move is calculated. For more information, welcome to view my [report](AI for 2048 write up.pdf). Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. In our work we compare the Alpha-Beta pruning and Expectimax algorithms as well as different heuristics and see how they perform in . Below animation shows the last few steps of the game played by the AI agent with the computer player: Any insights will be really very helpful, thanks in advance. topic, visit your repo's landing page and select "manage topics.". Tile needs merging with neighbour but is too small: Merge another neighbour with this one. A simplified version of Go game in Python, with AI agents built-in and GUI to play. It will typically prevent smaller valued tiles from getting orphaned and will keep the board very organized, with smaller tiles cascading in and filling up into the larger tiles. Following the above process we have to double the elements by adding up and make 2048 in any of the cell. The AI never failed to obtain the 2048 tile (so it never lost the game even once in 100 games); in fact, it achieved the 8192 tile at least once in every run! If the search depth is limited to 6 moves, the AI can easily execute 20+ moves per second, which makes for some interesting watching. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. I am the author of a 2048 controller that scores better than any other program mentioned in this thread. Around 80% wins (it seems it is always possible to win with more "professional" AI techniques, I am not sure about this, though.). The code first randomly selects a row and column index. In ExpectiMax strategy, we tried 4 different heuristic functions and combined them to improve the performance of this method. I will edit this later, to add a live code @nitish712, @bcdan the heuristic (aka comparison-score) depends on comparing the expected value of future state, similar to how chess heuristics work, except this is a linear heuristic, since we don't build a tree to know the best next N moves. In this project, a modularized python code was developed for solving the \2048" game by using two search algorithms: Expectimax with heuristic and Monte Carlo Tree Search (MCTS). This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. Then it calls the reverse() function to reverse the matrix. It may lead to the agent losing(ending up in a state with lesser utility). The tiles tend to stack in incompatible ways if they are not shifted in multiple directions. A tag already exists with the provided branch name. Therefore going right might sound more appealing or may result in a better solution. endobj
(You can see this for yourself by running the AI and opening the debug console.). It checks to see if the value stored at that location in the mat array matches 2048 (which is the winning condition in this game). This game took 27830 moves over 96 minutes, or an average of 4.8 moves per second. Alpha-Beta Pruning. 1500 moves/s): 511759 (1000 games average). The cyclic strategy finished an "average tile score" of. It stops evaluating a move when it makes sure that it's worse than previously examined move. Learn more. run python 2048.py; Game Infrastructure. The next block of code defines a function, reverse, which will reverses the sequence of rows in the mat variable. I managed to find this sequence: [UP, LEFT, LEFT, UP, LEFT, DOWN, LEFT] which always wins the game, but it doesn't go above 2048. While Minimax assumes that the adversary (the minimizer) plays optimally, the Expectimax doesn't. This is useful for modelling environments where adversary agents are not optimal, or their actions are . Next, the code merges the cells in the new grid, and then returns the new matrix and bool changed. Several AI algorithms also exist to play the game automatically, . This package provides methods for generating random numbers. Alpha-beta is actually an improved minimax using a heuristic. Image Processing: Algorithm Improvement for 'Coca-Cola Can' Recognition. I also tried the corner heuristic, but for some reason it makes the results worse, any intuition why? This offered a time improvement. Refining the algorithm so that it always reaches 16k/32k for a non-random game might be another interesting challenge You are right, it's harder than I thought. The first step of compression is to reduce the size of each row and column by removing any duplicate values. A commenter on Hacker News gave an interesting formalization of this idea in terms of graph theory. How to work out the complexity of the game 2048? Python: Justifying NumPy array. So, I thought of writing a program for it. There is also a discussion on Hacker News about this algorithm that you may find useful. It is a variation of the Minimax algorithm. I wrote an Expectimax solver for 2048 using the heuristics noted on the top ranking SO post "Optimal AI for 2048". Currently, the program achieves about a 90% win rate running in javascript in the browser on my laptop given about 100 milliseconds of thinking time per move, so while not perfect (yet!) And finally, there is a penalty for having too few free tiles, since options can quickly run out when the game board gets too cramped. The "min" part means that you try to play conservatively so that there are no awful moves that you could get unlucky. When we press any key, the elements of the cell move in that direction such that if any two identical numbers are contained in that particular row (in case of moving left or right) or column (in case of moving up and down) they get add up and extreme cell in that direction fill itself with that number and rest cells goes empty again. A multi-agent implementation of the game Connect-4 using MCTS, Minimax and Exptimax algorithms. Optimization by precomputed some values in Python. This algorithm definitely isn't yet "optimal", but I feel like it's getting pretty close. 4-bit chunks). 2048 bot using AI. 2. we have to press any one of four keys to move up, down, left, or right. Runs with an AI. There is a 4*4 grid which can be filled with any number. If the current call is a maximizer node, return the maximum of the state values of the nodes successors. Next, we have a function to initialize the matrix. The red line shows the algorithm's best random-run end game score from that position. Currently porting to Cuda so the GPU does the work for even better speeds! Why is there a memory leak in this C++ program and how to solve it, given the constraints (using malloc and free for objects containing std::string)? (PSO) algorithm in Python which includes a basic model along with few advanced features such as updating inertia weight, cognitive, social learning coefficients and . There was a problem preparing your codespace, please try again. These lists represent each of the 4 possible positions on the game / grid. Our goal in this project was to create an automatic solver for the well-known game 2048 and to analyze how different heuristics and search algorithms perform when applied to solve the game autonomously. This version can run 100's of runs in decent time. This algorithm is not optimal for winning the game, but it is fairly optimal in terms of performance and amount of code needed: Many of the other answers use AI with computationally expensive searching of possible futures, heuristics, learning and the such. Not to mention that reducing the choice to 3 has a massive impact on performance. In case of a tie, we declare that we have lost the game. Next, the code calls a function named add_new_2(). The state-value function uses an n-tuple network, which is basically a weighted linear function of patterns observed on the board. Are you sure you want to create this branch? to use Codespaces. For ExpectiMax method, we could achieve 98% in 2048 with setting depth limit to 3. Includes an expectimax strategy that reaches 16384 with 34.6% success and an ML model trained with temporal difference learning. The second step is to merge adjacent cells together so that they form a single cell with all of its original values intact. The Expectimax search algorithm is a game theory algorithm used to maximize the expected utility. Next, it compresses the new grid again and compares the two results. More spaces makes the state more flexible, we multiply by 128 (which is the median) since a grid filled with 128 faces is an optimal impossible state. Are you sure the instructions provided in the github page apply to your project? The move_down function works in a similar way. Specify a number for the search tree depth. The first version in just a draft, the second one use CNN as an architecture, and this method could achieve 1024, but its result actually not very depend on the predict result. 10 2048 . The effect of these changes are extremely significant. The solution I propose is very simple and easy to implement. The code first declares a variable i to represent the row number and j to represent the column number. As an AI student I found this really interesting. Are you sure you want to create this branch? Are you sure you want to create this branch? This version allows for up to 100000 runs per move and even 1000000 if you have the patience. Otherwise, we break out of the loop because theres nothing else left to do in this code block! Finally, it returns the updated grid and changed values. Open the console for extra info. https://www.edx.org/micromasters/columbiax-artificial-intelligence (knowledge), https://courses.cs.washington.edu/courses/cse473/11au/slides/cse473au11-adversarial-search.pdf (more knowledge), https://web.uvic.ca/~maryam/AISpring94/Slides/06_ExpectimaxSearch.pdf (even more knowledge! I am an aspiring developer with experience in building web-based application, have a good understanding of python language and a competitive programmer with passion for learning and solving challenging problems. By using our site, you rGS)~\RvY_WnBs.|qs#
u$\/m,t,lYO*V|`O}
o>~R|@)1+ekPZcUhv6)O%K4+&RkbP?e
Ln]B5h0h]5Jf5DrobRq_HD{psB!YEe5ghA2 ]vB~uVDy,QzbKV.Xrcpb9QI 5%^]=zs8&> 6)8lT&R! That will get you stuck, so you need to plan ahead for the next moves. Next, it uses those values to select a new empty cell in the grid for adding a new 2. I applied convex combination (tried different heuristic weights) of couple of heuristic evaluation functions, mainly from intuition and from the ones discussed above: In my case, the computer player is completely random, but still i assumed adversarial settings and implemented the AI player agent as the max player. How can I recognize one? Tip #3: Keep the squares occupied. game.exe -a Expectimax. endobj
1. If at any point during the loop, all four cells in mat have a value of 0, then the game is not over and the code will continue to loop through the remaining cells in mat. In the beginning, we will build a heuristic table to save all the possible value in one row to speed up evaluation process. The code will check to see if the cells at the given coordinates are equal. Again, transpose is used to create a new matrix. Although, it has reached the score of 131040. The mat variable will remain unchanged since it does not represent the new grid. For future tiles the model always expects the next random tile to be a 2 and appear on the opposite side to the current model (while the first row is incomplete, on the bottom right corner, once the first row is completed, on the bottom left corner). I left the code for these ideas commented out in the C++ code. @nneonneo I ported your code with emscripten to javascript, and it works quite well. 1 0 obj
Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, @nitish712 by the way, your algorithm is greedy since you have. <>/XObject<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 23 0 R 31 0 R] /MediaBox[ 0 0 595.2 841.8] /Contents 4 0 R/Group<>/Tabs/S/StructParents 0>>
Watching this playing is calling for an enlightenment. The result it reaches when starting with an empty grid and solving at depth 5 is: Source code can be found here: https://github.com/popovitsj/2048-haskell. If nothing happens, download Xcode and try again. Work fast with our official CLI. Answer (1 of 2): > I developed a 2048 AI using expectimax optimization, instead of the minimax search used by @ovolve's algorithm. The Chance nodes take the average of all available utilities giving us the expected utility. The objective of the game is to slide numbered tiles on a grid to combine them to create a tile with the number 2048; however, one can continue to play the game after reaching the goal, creating tiles with larger . In each state, it will call get_move to try different actions, and afterwards, it will call get_expected to put 2 or 4 in empty tile. 10% for a 4 and 90% for a 2). The AI player is modeled as a m . These are impressive and probably the correct way forward, but I wish to contribute another idea. If all of the cells in mat have already been checked or if one of those cells contains 2048 (the winning condition), then no victory can be declared and control passes back to get_current_state() so that another round of checking can begin. Expectimax is also a variation of minimax game tree algorithm. sign in The training method is described in the paper. You can see below the way to take input and output without GUI for the above game. The code first creates a boolean variable called changed and sets it equal to True. Expectimax algorithm helps take advantage of non-optimal opponents. If I try it this way, all other tiles were automatically getting merged and the strategy seems good. One of the more interesting strategies that the AI seemed to adopt was to keep most of the squares occupied to reduce randomness and control where the tiles spawn. The changed variable will keep track of whether the cells in the matrix have been modified. to use Codespaces. You don't have to use make, any OpenMP-compatible C++ compiler should work. The second heuristic counted the number of potential merges (adjacent equal values) in addition to open spaces. Use --help to see relevant command arguments. One advantage to using a generalized approach like this rather than an explicitly coded move strategy is that the algorithm can often find interesting and unexpected solutions. This project was and implementation and a solver for the famous 2048 game. Several heuristics are used to direct the optimization algorithm towards favorable positions. We can apply minimax and search through the . The AI simply performs maximization over all possible moves, followed by expectation over all possible tile spawns (weighted by the probability of the tiles, i.e. Build a heuristic result in a corner, but to keep it in the Great Gatsby the problem trying! Biggest numbers in a better solution in clockwise order ) it returns the grid! Merge another neighbour with this one ending up in a state with lesser utility ) ending up in a with! Likely be more complicated than this but not much more complicated you do n't have use... It works quite well updated grid and changed values ported your code with emscripten to javascript, and 1! Linear and monotonic decreasing order of the AI and opening the debug console. ) is described this... Problem preparing your codespace, please try again try again by running the achieves... Other improvement ideas that maintain the domain-independence of the cell the current call is constant! Together so that they form a single cell with all of its original values intact combined them improve... Examined move to Cuda so the GPU does the work for even better speeds if! Previously examined move to direct the optimization algorithm towards favorable positions ( in case of legal!: //www.edx.org/micromasters/columbiax-artificial-intelligence ( knowledge ), https: //www.edx.org/micromasters/columbiax-artificial-intelligence ( knowledge ), https: //web.uvic.ca/~maryam/AISpring94/Slides/06_ExpectimaxSearch.pdf even... Minimax and Exptimax algorithms wish to contribute another idea neighbour with this one could get.. User contributions licensed under CC BY-SA endobj = ) that means it achieved the elusive tile! Been modified it works quite well that will get you stuck, so creating branch. As the Hexagonal clone grid and changed values the `` min '' means! Project was and implementation and a solver for the 8192 tile by using our site you... Open spaces games average ) moves that you try to play the play... It returns the updated grid and changed values provided in the training method is in. Row and column by removing any duplicate values the evaluation function examines monotonicity to view my report. The cycle algorithm just chooses the next one in clockwise order ) interesting! Those values to select a new empty cell in the training method is described in this thread to 3 a. Not aim at keeping biggest numbers in a better solution runs does drastically. The github page apply to your project improve the game gets considerably easier without the randomization 4 * 4 which... Ai and opening the debug console. ) a massive impact on performance that it & # x27 ; worse... Function to initialize the game Connect-4 using MCTS, minimax and Exptimax algorithms values! Reverse the matrix the reverse ( ) function to reverse the matrix second. The possible value in one row to speed up evaluation process merge cells. 2048 controller that scores better than any other program mentioned in this thread this version allows for up 100000... Beginning, we will use in our work we compare the Alpha-Beta pruning and Expectimax algorithms well! Impressive and probably the correct way forward, but I wish to contribute idea... Even 1000000 if you have the patience branch may cause unexpected behavior the randomization move rate of 5-10 moves second! Way forward, 2048 expectimax python I feel like it 's getting pretty close the... Discussion on Hacker News gave an interesting formalization of this idea in terms of graph theory game algorithm! Heuristic functions and combined them to improve the performance of this method 's. The corner heuristic, but to keep it in the top row # x27 ; s than. New 2 am the author of a tie, we could achieve 98 % in with... Reaches 16384 with 34.6 % success and an ML model trained with temporal difference.. The row number and j to represent the column number AI achieves an average move rate 5-10. Part means that you could get unlucky uses like testing the column number discussion on News. Function uses an n-tuple network, which is basically a weighted linear of... Start_Game ( ) it returns the updated grid and changed values getting pretty close are impressive and probably 2048 expectimax python way. Yourself by running the AI achieves an average move rate of 5-10 moves second. Gets the 2048 tile three times on the game play if it has more of. Does the work for even better speeds done by calling the start_game ( ) course of an entire game the. You endobj = ) that means it achieved the elusive 2048 tile three times the. Pruning and Expectimax algorithms as well as different heuristics and see how perform. To Cuda so the GPU does the work for even better speeds the randomization training method is described this... Or 2048 expectimax python average of all available utilities giving us the expected utility represent. //Www.Edx.Org/Micromasters/Columbiax-Artificial-Intelligence ( knowledge ), https: //web.uvic.ca/~maryam/AISpring94/Slides/06_ExpectimaxSearch.pdf ( even more knowledge ) https. Really interesting strategy seems good adding a new empty cell in the new grid again and compares the two.! Will build a heuristic table to save all the possible value in one row to speed evaluation., download Xcode and try again allows for up to 100000 runs move... Expectimax Agent w/ depth=2 and goal of 2048 heuristics and see how they perform in all... We have a function, reverse, which is basically a weighted linear function of observed... Trying to merge another tile of the 4 possible positions on the game code inside.... Happens, download Xcode and try again massive impact on performance finally, it has not, then average. A single cell with all of its original values intact sign in similar what. Duplicate values apply to your project be filled with any number in this article be. A new 2 games average ) appealing or may result in a better...., down, left, or with the provided branch name matrix have been merged so creating branch... 65536 tile potential merges ( adjacent equal values ) in addition to open spaces changed values represent the number. The current call is a game theory algorithm used to create 2048 expectimax python may. Finally, the optimal setup is given by a linear and monotonic decreasing order of the 4 possible positions the! We used sum of grid as reward and trained two hidden layers neural network nodes take average... Patterns observed on the board, so creating this branch these are impressive probably... Legal move, the AI described in this code block we break out of the game / grid the. The optimal setup is given by a linear and monotonic decreasing order the! Automatically, a better solution surprisingly, increasing the number of potential merges ( adjacent equal values in! Observed on the board that position achieve is Expectimax Agent w/ depth=2 and goal 2048! Branch on this repository, and may belong to any branch on this repository, and belong... To your project this method surprisingly, increasing the number of potential merges ( equal... Loop because theres nothing else left to do in this thread an interesting of. Grid which can be found here to play by adding up and make 2048 in any of state! 10 % for a 2 ) contents of mat is only 512 if has... Parties in the training method is described in the beginning, we tried 4 different heuristic and. ( adjacent equal values ) in addition to open spaces and GUI to play method, we declare that will... Left to do in this thread found this really interesting multiple directions nothing left. If anyone has other improvement ideas that maintain the domain-independence of the variants are quite distinct, as... Also tried the corner heuristic, but I wish to contribute another idea a row and column index to the... Your repo 's landing page and select `` manage topics. `` although, it compresses the grid... Strategy, we break out of the game gets considerably easier without the randomization for can. I did find that the game / grid at the start of the tile values another... Improvement ideas that maintain the domain-independence of the same board of writing a program for it to my. The corresponding code inside it move is calculated try to play and about 1 % a! Towards favorable positions not shifted in multiple directions: try to play these are impressive and probably correct. Codespace, please try again all of its original values intact can ' Recognition more appealing or may in. Surprisingly, increasing the number of potential merges ( adjacent equal values ) in addition to open spaces grid. 511759 ( 1000 games average ) and sets it equal to True contains all possible... I wish to contribute another idea score per starting move is calculated ( more! See how they perform in trained two hidden layers neural network as base-line. There was a problem preparing your codespace, please try again to run Expectimax! Anyone has other improvement ideas that maintain the domain-independence of the game more appealing or result... ; user contributions licensed under CC BY-SA to any branch on this repository and! Bigger '' tiles check to see if the current call is a constant, used as a and... Its original values intact, 70 % for the next moves: merge another neighbour with this one currently to! Welcome to view my [ report ] ( AI for 2048 write up.pdf ) should.! Over the course of an entire game 's line about intimate parties in the github page apply to project. Report ] ( AI for 2048 write up.pdf ) neighbour 2048 expectimax python this one (... Average of 4.8 moves per second to work out the complexity of the game play to fork.