[iagno] Specify ComputerReversiHard depth.



commit 9c19c68558bb024421b2ef3ed6ce36cdd884eeed
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu May 23 21:44:18 2019 +0200

    Specify ComputerReversiHard depth.

 src/computer-reversi.vala | 4 ++--
 src/iagno.vala            | 2 +-
 src/test-iagno.vala       | 8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/computer-reversi.vala b/src/computer-reversi.vala
index 4fc9a8d..bf03d18 100644
--- a/src/computer-reversi.vala
+++ b/src/computer-reversi.vala
@@ -89,9 +89,9 @@ private class ComputerReversiHard : ComputerReversi
         init_heuristic (size, out heuristic);
     }
 
-    internal ComputerReversiHard (Game game, uint8 difficulty_level)
+    internal ComputerReversiHard (Game game, uint8 initial_depth)
     {
-        Object (game: game, initial_depth: difficulty_level * 2);
+        Object (game: game, initial_depth: initial_depth);
     }
 
     /*\
diff --git a/src/iagno.vala b/src/iagno.vala
index 1bc4d43..4e1f72e 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -379,7 +379,7 @@ private class Iagno : Gtk.Application
             if (computer_level == 1)
                 computer = new ComputerReversiEasy (game);
             else
-                computer = new ComputerReversiHard (game, computer_level);
+                computer = new ComputerReversiHard (game, /* depth */ computer_level * 2);
         }
 
         if (settings.get_enum ("color") == 1)
diff --git a/src/test-iagno.vala b/src/test-iagno.vala
index d549ac1..6cb8cf2 100644
--- a/src/test-iagno.vala
+++ b/src/test-iagno.vala
@@ -250,7 +250,7 @@ private class TestIagno : Object
                            /* 7 */ " . . . . . . . ." };
 
         Game game = new Game.from_strings (board, Player.DARK);
-        ComputerPlayer ai = new ComputerReversiHard (game, /* AI level */ 3);
+        ComputerPlayer ai = new ComputerReversiHard (game, /* depth */ 6);
 
         assert_true (game.place_tile (4, 1));
         assert_true (ai_move (ai, 5, 5));
@@ -323,7 +323,7 @@ private class TestIagno : Object
                            /* 7 */ " . . . . . . . ." };
 
         Game game = new Game.from_strings (board, Player.DARK);
-        ComputerPlayer ai = new ComputerReversiHard (game, /* AI level */ 3);
+        ComputerPlayer ai = new ComputerReversiHard (game, /* depth */ 6);
 
         assert_true (game.place_tile (4, 2));
         assert_true (ai_move (ai, 5, 5));
@@ -396,7 +396,7 @@ private class TestIagno : Object
                            /* 7 */ " . . . . . . . ." };
 
         Game game = new Game.from_strings (board, Player.DARK);
-        ComputerPlayer ai = new ComputerReversiHard (game, /* AI level */ 3);
+        ComputerPlayer ai = new ComputerReversiHard (game, /* depth */ 6);
 
         assert_true (ai_move (ai, 3, 5));
         assert_true (game.place_tile (6, 3));
@@ -469,7 +469,7 @@ private class TestIagno : Object
                            /* 7 */ " . . . . . . . ." };
 
         Game game = new Game.from_strings (board, Player.DARK);
-        ComputerPlayer ai = new ComputerReversiHard (game, /* AI level */ 3);
+        ComputerPlayer ai = new ComputerReversiHard (game, /* depth */ 6);
 
         assert_true (ai_move (ai, 5, 4));
         assert_true (game.place_tile (6, 4));


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