2048遊戲的最佳算法是什麼? - What is the optimal algorithm for the game 2048?

問題:

I have recently stumbled upon the game 2048 . 我最近偶然發現了2048遊戲。 You merge similar tiles by moving them in any of the four directions to make "bigger" tiles. 您能夠經過在四個方向上任意移動類似的圖塊來合併它們,以製做「更大」的圖塊。 After each move, a new tile appears at random empty position with a value of either 2 or 4 . 每次移動後,新的圖塊將出如今隨機的空白位置,值爲24 The game terminates when all the boxes are filled and there are no moves that can merge tiles, or you create a tile with a value of 2048 . 當全部盒子都裝滿而且沒有能夠合併磁貼的移動,或者您建立的值爲2048磁貼時,遊戲終止。 git

One, I need to follow a well-defined strategy to reach the goal. 第一,我須要遵循明肯定義的策略才能實現目標。 So, I thought of writing a program for it. 所以,我想到了爲此編寫程序。 github

My current algorithm: 我當前的算法: 算法

while (!game_over) {
    for each possible move:
        count_no_of_merges_for_2-tiles and 4-tiles
    choose the move with a large number of merges
}

What I am doing is at any point, I will try to merge the tiles with values 2 and 4 , that is, I try to have 2 and 4 tiles, as minimum as possible. 我正在作的是在任什麼時候候,我將嘗試合併值24的圖塊,也就是說,我嘗試將24圖塊儘量地減小。 If I try it this way, all other tiles were automatically getting merged and the strategy seems good. 若是以這種方式嘗試,全部其餘磁貼將自動合併,而且該策略看起來不錯。 app

But, when I actually use this algorithm, I only get around 4000 points before the game terminates. 可是,當我實際使用該算法時,在遊戲終止以前我只能獲得4000點。 Maximum points AFAIK is slightly more than 20,000 points which is way larger than my current score. 最高分數AFAIK略高於20,000點,這比我目前的分數還大。 Is there a better algorithm than the above? 是否有比以上更好的算法? dom


解決方案:

參考一: https://stackoom.com/question/1VkOc/遊戲的最佳算法是什麼
參考二: https://oldbug.net/q/1VkOc/What-is-the-optimal-algorithm-for-the-game-2048
相關文章
相關標籤/搜索