about summary refs log tree commit diff
path: root/mapScore.py
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2021-11-24 00:20:05 -0500
committerZach DeCook <zachdecook@librem.one>2021-11-24 00:20:05 -0500
commitf5b1deff869586314c608e898bc43fbb432065aa (patch)
treef3050cabc45650e0a481ff125e47e326fbe5be04 /mapScore.py
parentd4fc2356cf7527e8273eb39d90e5a3f80a7e84ae (diff)
downloadswipeGuess-f5b1deff869586314c608e898bc43fbb432065aa.tar.gz
mapscore: create map from file
Diffstat (limited to 'mapScore.py')
-rwxr-xr-xmapScore.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/mapScore.py b/mapScore.py
new file mode 100755
index 0000000..1a8dfa9
--- /dev/null
+++ b/mapScore.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+import sys
+
+def makeMap(filename):
+  l= [(0,0) for x in range(0,127)]
+  with open(filename) as f:
+    x=0;y=0
+    while 1:
+      c = f.read(1)
+      if c == '\t':
+        x=x+1
+      elif c == '\n':
+        x=0;y=y+1
+      elif c:
+        l[ord(c)] =(x,y)
+      else:
+        break
+  return l
+
+def main(argv):
+  import json
+  json.dump(makeMap(argv[1]),sys.stdout)
+
+if __name__ == '__main__':
+  main(sys.argv)