Added initial files master
authorPi@Raspberry <pi@njae.me.uk>
Thu, 30 Oct 2014 21:49:09 +0000 (21:49 +0000)
committerPi@Raspberry <pi@njae.me.uk>
Thu, 30 Oct 2014 21:49:09 +0000 (21:49 +0000)
word_grid_game.py [new file with mode: 0644]
words.txt [new file with mode: 0644]

diff --git a/word_grid_game.py b/word_grid_game.py
new file mode 100644 (file)
index 0000000..e65ae2d
--- /dev/null
@@ -0,0 +1,31 @@
+import random
+
+all_words=[i.strip() for i in open("words.txt").readlines()]
+
+def get_difficulty():
+    game="fail"
+    while game!="EASY" and game != "HARD":
+        game=input("choose the difficulty easy or hard...").upper()
+    print("you have 30 seconds (45 if you picked 'hard') to memorise a grid of words. Good luck...")
+    return game == "EASY"
+
+def words_for_game(words, is_easy):
+    if is_easy:
+        return words[:10]
+    else:
+        return words[:]
+
+def print_grid(words):
+    print(words)
+
+
+#   random.shuffle(words)
+#   added_word=words.pop()
+#   for i in range(3):
+#       print(words[3*i],words[3*i+1],words[3*i+2])
+
+def play_game():
+    is_easy = get_difficulty()
+    words = words_for_game(all_words, is_easy)
+    random.shuffle(words)
+    print_grid(words)
diff --git a/words.txt b/words.txt
new file mode 100644 (file)
index 0000000..00af9b2
--- /dev/null
+++ b/words.txt
@@ -0,0 +1,17 @@
+XXXXA
+XXXXB
+XXXXC
+XXXXD
+XXXXE
+XXXXF
+XXXXG
+XXXXH
+XXXXI
+XXXXJ
+XXXXK
+XXXXL
+XXXXM
+XXXXN
+XXXXO
+XXXXP
+XXXXQ