fix executable modules, more documentation
[imago.git] / imago_pack / sgf.py
index 13543fe..3999f77 100644 (file)
@@ -1,22 +1,26 @@
 import sys
 
-coords = 'abcdefghijklmnopqrs'
+def main():
+    coords = 'abcdefghijklmnopqrs'
 
-board = sys.stdin.read().split('\n')
-board = [line.split() for line in board]
+    board = sys.stdin.read().split('\n')
+    board = [line.split() for line in board]
 
-black = []
-white = []
+    black = []
+    white = []
 
-for i in range(19):
-    for j in range(19):
-        if board[i][j] == 'B':
-            black.append((i, j))
-        elif board[i][j] == 'W':
-            white.append((i, j))
+    for i in range(19):
+        for j in range(19):
+            if board[i][j] == 'B':
+                black.append((i, j))
+            elif board[i][j] == 'W':
+                white.append((i, j))
 
-#TODO version numbering
-print "(;FF[4]GM[1]SZ[19]AP[Imago:0.1.0]"
-print "AB" + ''.join('[' + coords[j] + coords[i] + ']' for (i, j) in black) 
-print "AW" + ''.join('[' + coords[j] + coords[i] + ']' for (i, j) in white)
-print ")"
+    #TODO version numbering
+    print "(;FF[4]GM[1]SZ[19]AP[Imago:0.1.0]"
+    print "AB" + ''.join('[' + coords[j] + coords[i] + ']' for (i, j) in black) 
+    print "AW" + ''.join('[' + coords[j] + coords[i] + ']' for (i, j) in white)
+    print ")"
+
+if __name__ == '__main__':
+    main()