big update, better formalization for pegsol
[ar1516.git] / a2 / src / 4 / a4.py
index b216b3b..9c5b015 100644 (file)
@@ -1,23 +1,17 @@
 #!/bin/env python
-#pylint: disable-msg=too-many-locals,invalid-name
-"""hi"""
+#pylint: disable-msg=too-many-locals,invalid-name,missing-docstring
 
-def generate():
-    """Generates the yices code for peg solitaire"""
+if __name__ == '__main__':
     pos = [(x, y) for x in range(7) for y in range(7) if
            not ((x < 2 and y < 2) or # exclude topleft
                 (x > 4 and y > 4) or # exclude bottomright
                 (x > 4 and y < 2) or # exclude topright
                 (x < 2 and y > 4))   # exclude bottomleft
           ]
-    ill_middles = [
-        (2, 0), (4, 0), (0, 2), (0, 4), (6, 2), (6, 4), (2, 6), (4, 6)]
     holes = [(3, 3)]
     winning = (3, 3)
 
-
     iterations = len(pos)-len(holes)
-    posp = [p for p in pos if p not in ill_middles]
     print """
     (benchmark a1.smt
     :logic QF_UF
@@ -39,7 +33,7 @@ def generate():
         print ';Iteration {}'.format(i)
         print '(or'
         for sx, sy in pos:
-            for mx, my in posp:
+            for mx, my in pos:
                 if mx == sx and my == sy:
                     continue
                 for ex, ey in pos:
@@ -77,6 +71,3 @@ def generate():
                    for x, y in pos if (x, y) != winning)
 
     print '))'
-
-if __name__ == '__main__':
-    generate()