[iagno] game: simplify implementation of n_tiles



commit 32c1533285ea25d5c99e305c91d573952489b0c2
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Fri Sep 27 22:03:01 2013 -0500

    game: simplify implementation of n_tiles

 src/game.vala |   14 +-------------
 1 files changed, 1 insertions(+), 13 deletions(-)
---
diff --git a/src/game.vala b/src/game.vala
index 32cb6cc..74638ea 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -46,19 +46,7 @@ public class Game
     /* The number of tiles on the board */
     public int n_tiles
     {
-        get
-        {
-            var count = 0;
-            for (var x = 0; x < width; x++)
-            {
-                for (var y = 0; y < height; y++)
-                {
-                    if (tiles[x, y] != Player.NONE)
-                        count++;
-                }
-            }
-            return count;
-        }
+        get { return n_light_tiles + n_dark_tiles; }
     }
 
     public int n_light_tiles


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