summary refs log tree commit diff
path: root/mapScore.py
diff options
context:
space:
mode:
Diffstat (limited to 'mapScore.py')
-rwxr-xr-xmapScore.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/mapScore.py b/mapScore.py
index 1a8dfa9..4f69847 100755
--- a/mapScore.py
+++ b/mapScore.py
@@ -17,9 +17,20 @@ def makeMap(filename):
         break
   return l
 
+def scoreWord(word,mmap):
+  pc=word[0]
+  s=0
+  for c in word:
+    #manhattan dist
+    s+=abs(mmap[ord(pc)][0]-mmap[ord(c)][0])
+    s+=abs(mmap[ord(pc)][1]-mmap[ord(c)][1])
+    pc=c
+  return s
+  
+
 def main(argv):
-  import json
-  json.dump(makeMap(argv[1]),sys.stdout)
+  mmap=makeMap(argv[1])
+  print(scoreWord('ads',mmap))
 
 if __name__ == '__main__':
   main(sys.argv)