[iagno/gnome-3-32] Fix AI on non standard boards.



commit 1d58f75e0b1f1911b755938ac246534757eef6e5
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Mar 29 14:20:55 2019 +0100

    Fix AI on non standard boards.

 src/computer-player.vala | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/src/computer-player.vala b/src/computer-player.vala
index a0dfead..760be13 100644
--- a/src/computer-player.vala
+++ b/src/computer-player.vala
@@ -325,7 +325,7 @@ private class ComputerPlayer : Object
             return -tile_difference;
 
         /* End of the game: just maximize the number of tokens */
-        if (g.n_tiles >= 54)
+        if (g.n_tiles >= (g.size * g.size) - 10)
             return tile_difference;
 
         /* Normal strategy: try to evaluate the position */
@@ -338,7 +338,6 @@ private class ComputerPlayer : Object
             return 0;
 
         int count = 0;
-
         for (uint8 x = 0; x < g.size; x++)
         {
             for (uint8 y = 0; y < g.size; y++)
@@ -349,7 +348,6 @@ private class ComputerPlayer : Object
                 count += h;
             }
         }
-
         return count;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]