working chip location
[master.git] / ar / assignments / src / 2.py
index bbaabf0..2b5ed99 100644 (file)
@@ -50,20 +50,31 @@ for i, (w, h) in enumerate(pc+rc, 1):
                 ')').format(i, j))
 
 # Print the PC distance to eachother
-#for i, _ in enumerate(pc, 1):
-#    for j, _ in enumerate(pc, 1):
-#        if i != j:
-#            print((
-#                '\t(or \n'
-#                '\t\t(> (- (/ (+ c{0:02d}x c{0:02d}w) 2) '
-#                '(/ (+ c{1:02d}x c{1:02d}w) 2)) {2})\n'
-#                '\t\t(> (- (/ (+ c{1:02d}x c{1:02d}w) 2) '
-#                '(/ (+ c{0:02d}x c{0:02d}w) 2)) {2})\n'
-#                '\t\t(> (- (/ (+ c{0:02d}y c{0:02d}h) 2) '
-#                '(/ (+ c{1:02d}y c{1:02d}h) 2)) {2})\n'
-#                '\t\t(> (- (/ (+ c{1:02d}y c{1:02d}h) 2) '
-#                '(/ (+ c{0:02d}y c{0:02d}h) 2)) {2})'
-#                ')').format(i, j, pd))
+for i, _ in enumerate(pc, 1):
+    for j, _ in enumerate(pc, 1):
+        if i != j:
+            print((
+                '\t(or \n'
+                '\t\t(> \n'
+                '\t\t\t(- \n'
+                '\t\t\t\t(+ \n'
+                '\t\t\t\t\tc{0:02d}x \n'
+                '\t\t\t\t\t(/ c{0:02d}w 2) \n'
+                '\t\t\t\t) \n'
+                '\t\t\t\t(+ \n'
+                '\t\t\t\t\tc{1:02d}x \n'
+                '\t\t\t\t\t(/ c{1:02d}w 2) \n'
+                '\t\t\t\t) \n'
+                '\t\t\t) \n'
+                '\t\t\t{2} \n'
+                '\t\t)\n'
+                '\t\t(> (- (+ c{1:02d}x (/ c{1:02d}w 2)) '
+                '(+ c{0:02d}x (/ c{0:02d}w 2))) {2})\n'
+                '\t\t(> (- (+ c{0:02d}y (/ c{0:02d}h 2)) '
+                '(+ c{1:02d}y (/ c{1:02d}h 2))) {2})\n'
+                '\t\t(> (- (+ c{1:02d}y (/ c{1:02d}h 2)) '
+                '(+ c{0:02d}y (/ c{0:02d}h 2))) {2})'
+                ')').format(i, j, pd))
 
 # Print the constraint that they have to be connected to a ps
 for i, _ in enumerate(rc, 1+len(pc)):