[gnome-mahjongg] Add method counting number of moveable tiles



commit f1a4852633af0ba010c2bc7f935dd8c69f697632
Author: Mario Wenzel <maweki gmail com>
Date:   Sun Aug 17 20:31:50 2014 +0200

    Add method counting number of moveable tiles
    
    this will be used in solving https://bugzilla.gnome.org/show_bug.cgi?id=732225
    If this method returns 1, shuffling should be disabled

 src/game.vala |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/game.vala b/src/game.vala
index 46c7449..abcd002 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -347,6 +347,14 @@ public class Game : Object
         return true;
     }
 
+    public int number_of_movable_tiles () {
+        int count = 0;
+        foreach (var tile in tiles)
+            if (tile_can_move(tile))
+                count++;
+        return count;
+    }
+
     public List<Match> find_matches (Tile? tile = null)
     {
         List<Match> matches = null;


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