[iagno] Don't use six lines for a corner case.



commit 5b78b24a5b552a2a2f6f9968e0e1a6412497ac8a
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat Sep 27 08:46:02 2014 +0200

    Don't use six lines for a corner case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=737410

 src/computer-player.vala |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
---
diff --git a/src/computer-player.vala b/src/computer-player.vala
index 7de529e..71cb5a3 100644
--- a/src/computer-player.vala
+++ b/src/computer-player.vala
@@ -178,18 +178,12 @@ public class ComputerPlayer : Object
          * strategy. */
         var g = new Game.copy (game);
         var depth = difficulty_level * 2;
-        var a = NEGATIVE_INFINITY;
+        /* The -1 is because the search sometimes returns NEGATIVE_INFINITY. */
+        var a = NEGATIVE_INFINITY - 1;
 
         var moves = new List<PossibleMove?> ();
         get_possible_moves_sorted (g, ref moves);
 
-        /* We use (0, 0) as our default move; if we don't change that,
-         * a search could select it even if invalid at the end of the game.
-         */
-        var default_move = moves.nth_data (0);
-        x = default_move.x;
-        y = default_move.y;
-
         /* Try each move using alpha-beta pruning to optimise finding the best branch */
         foreach (var move in moves)
         {


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