[iagno] Little thing in computer-player.vala.



commit fcc64c175c6ad305df5a9316be081ffa148dfe16
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat Aug 30 00:06:30 2014 +0200

    Little thing in computer-player.vala.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735615

 src/computer-player.vala |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/src/computer-player.vala b/src/computer-player.vala
index 0e1b885..d2adc0e 100644
--- a/src/computer-player.vala
+++ b/src/computer-player.vala
@@ -256,21 +256,16 @@ public class ComputerPlayer : Object
     {
         List<int> moves = null;
         for (var x = 0; x < 8; x++)
-        {
             for (var y = 0; y < 8; y++)
-            {
                 if (g.can_place (x, y, g.current_color))
                     moves.append (x * 8 + y);
-            }
-        }
-        if (moves != null)
-        {
-            var i = Random.int_range (0, (int) moves.length ());
-            var xy = moves.nth_data (i);
-            move_x = xy / 8;
-            move_y = xy % 8;
-        }
-        else
-            move_x = move_y = 0;
+
+        if (moves == null)
+            warn_if_reached ();
+
+        var i = Random.int_range (0, (int) moves.length ());
+        var xy = moves.nth_data (i);
+        move_x = xy / 8;
+        move_y = xy % 8;
     }
 }


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