Commits

Chas Leichner committed 93cbeca

fixed infinite loop in random mole generation function

Comments (0)

Files changed (1)

games/mole/mole.py

         #self.player_images = (MTWidget(),MTSvg(filename='cross.svg'),MTSvg(filename='circle.svg') )
         self.done = False
 
-    def matrix_proportion(self):
-        size = len(self.matrix) * len(self.matrix[0])
+    def matrix_proportion(self, matrix):
+        size = len(matrix) * len(matrix[0])
         on = 0.0
         for row in self.matrix:
             for cell in row:
                 return 1
             else:
                 return 0
+
         return [[generate_num() for x in xrange(len(self.matrix))] for y in xrange(len(self.matrix[0]))]
 
     def draw(self):