[iagno] Make difficulty_level an uint8.



commit e9fc5878d8879d06d93df3af9fcd09928c9bab2d
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon Feb 25 20:39:34 2019 +0100

    Make difficulty_level an uint8.

 src/computer-player.vala | 6 +++---
 src/iagno.vala           | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/computer-player.vala b/src/computer-player.vala
index 0b029fa..3e3e716 100644
--- a/src/computer-player.vala
+++ b/src/computer-player.vala
@@ -42,7 +42,7 @@ private class ComputerPlayer : Object
     private Game game;
 
     /* Strength */
-    private int difficulty_level;
+    private uint8 difficulty_level;
 
     /* Value of owning each location */
     private const int [] heuristic =    // TODO make int [,]
@@ -82,7 +82,7 @@ private class ComputerPlayer : Object
         }
     }
 
-    internal ComputerPlayer (Game game, int difficulty_level = 1)
+    internal ComputerPlayer (Game game, uint8 difficulty_level = 1)
     {
         this.game = game;
         this.difficulty_level = difficulty_level;
@@ -305,7 +305,7 @@ private class ComputerPlayer : Object
     * * AI
     \*/
 
-    private static int calculate_heuristic (ref Game g, ref int difficulty_level)
+    private static int calculate_heuristic (ref Game g, ref uint8 difficulty_level)
     {
         int tile_difference = g.n_current_tiles - g.n_opponent_tiles;
 
diff --git a/src/iagno.vala b/src/iagno.vala
index 74bd60c..259ba7e 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -372,7 +372,7 @@ private class Iagno : Gtk.Application
         if (settings.get_int ("num-players") == 2)
             computer = null;
         else
-            computer = new ComputerPlayer (game, settings.get_int ("computer-level"));
+            computer = new ComputerPlayer (game, (uint8) settings.get_int ("computer-level"));
 
         if (settings.get_enum ("color") == 1)
             player_one = Player.LIGHT;


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