From 6d4889117dd25bd50bf82125f08c959e59e22081 Mon Sep 17 00:00:00 2001 From: "Pi@Raspberry" Date: Thu, 30 Oct 2014 21:49:09 +0000 Subject: [PATCH 1/1] Added initial files --- word_grid_game.py | 31 +++++++++++++++++++++++++++++++ words.txt | 17 +++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 word_grid_game.py create mode 100644 words.txt diff --git a/word_grid_game.py b/word_grid_game.py new file mode 100644 index 0000000..e65ae2d --- /dev/null +++ b/word_grid_game.py @@ -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 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 -- 2.34.1