Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/model.py
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2007-06-30 16:56:03 (GMT)
committer Simon Schampijer <simon@schampijer.de>2007-06-30 16:56:03 (GMT)
commitd421e4b20f4a392bbb711da832740a3baa641592 (patch)
tree2aa17987b89f92f25b94354a4184ceee831e62f3 /model.py
parent89a8709e6fbcb3ac29c0ccedc58aa6c5bab14f82 (diff)
- moved model in the ConnectionGame
- clean
Diffstat (limited to 'model.py')
-rw-r--r--model.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/model.py b/model.py
index 6d2811d..3545c0b 100644
--- a/model.py
+++ b/model.py
@@ -1,11 +1,13 @@
import libxml2
import os
import logging
+import random
class Model(object):
def __init__(self, gamepath, dtdpath, name='noname'):
self.name = name
self.pairs = {}
+ self.grid = []
self.gamepath = gamepath
self.dtdpath = dtdpath
@@ -67,7 +69,19 @@ class Model(object):
if doc.validateDtd(self.ctxt, self.dtd):
doc.saveFormatFile(filename, 1)
doc.freeDoc()
-
+
+ def def_grid(self):
+ print 'pairs: %s' %self.model.pairs
+ ### create grid from pairs information
+ for key in self.pairs.iterkeys():
+ self.grid.append((key, 0))
+ self.grid.append((key, 1))
+ print 'self.grid: %s'%self.grid
+
+ ### shuffle the grid tiles
+ random.shuffle(self.grid)
+ print 'self.grid after shufle: %s'%self.grid
+
if __name__ == '__main__':
print "[Read game from file] "