[iagno] Use SList instead of List.



commit 70eb6c55515104fff45e42c43602e9dceae7c085
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri May 10 17:19:07 2019 +0200

    Use SList instead of List.

 src/computer-reversi.vala | 12 ++++++------
 src/game.vala             |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/computer-reversi.vala b/src/computer-reversi.vala
index d83c23e..f1ff6df 100644
--- a/src/computer-reversi.vala
+++ b/src/computer-reversi.vala
@@ -45,7 +45,7 @@ private class ComputerReversiEasy : ComputerReversi
     * * minimax / negamax / alpha-beta pruning
     \*/
 
-    protected override void sort_moves (ref List<PossibleMove?> moves)
+    protected override void sort_moves (ref SList<PossibleMove?> moves)
     {
         moves.sort (compare_move);
     }
@@ -90,7 +90,7 @@ private class ComputerReversiHard : ComputerReversi
     * * minimax / negamax / alpha-beta pruning
     \*/
 
-    protected override void sort_moves (ref List<PossibleMove?> moves)
+    protected override void sort_moves (ref SList<PossibleMove?> moves)
     {
         moves.sort_with_data (compare_move);
     }
@@ -250,7 +250,7 @@ private abstract class ComputerReversi : ComputerPlayer
 
     private static void random_select (GameState g, out uint8 move_x, out uint8 move_y)
     {
-        List<PossibleMove?> moves;
+        SList<PossibleMove?> moves;
         g.get_possible_moves (out moves);
 
         int32 length = (int32) moves.length ();
@@ -290,7 +290,7 @@ private abstract class ComputerReversi : ComputerPlayer
         /* The search sometimes returns NEGATIVE_INFINITY. */
         int16 a = LESS_THAN_NEGATIVE_INFINITY;
 
-        List<PossibleMove?> moves;
+        SList<PossibleMove?> moves;
         g.get_possible_moves (out moves);
         sort_moves (ref moves);
 
@@ -331,7 +331,7 @@ private abstract class ComputerReversi : ComputerPlayer
 
         if (g.current_player_can_move)
         {
-            List<PossibleMove?> moves;
+            SList<PossibleMove?> moves;
             g.get_possible_moves (out moves);
             sort_moves (ref moves);
 
@@ -365,5 +365,5 @@ private abstract class ComputerReversi : ComputerPlayer
     }
 
     protected abstract int16 calculate_heuristic (GameState g);
-    protected abstract void sort_moves (ref List<PossibleMove?> moves);
+    protected abstract void sort_moves (ref SList<PossibleMove?> moves);
 }
diff --git a/src/game.vala b/src/game.vala
index fbc393b..2192000 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -174,9 +174,9 @@ private class GameState : Object
     * * ... // completeness
     \*/
 
-    internal void get_possible_moves (out List<PossibleMove?> moves)
+    internal void get_possible_moves (out SList<PossibleMove?> moves)
     {
-        moves = new List<PossibleMove?> ();
+        moves = new SList<PossibleMove?> ();
 
         for (; x_saved < size; x_saved++)
         {


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