We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8e7c091 commit 94fee6aCopy full SHA for 94fee6a
__pycache__/game.cpython-38.pyc
-26 Bytes
game.py
@@ -4,20 +4,18 @@
4
5
import string
6
import random
7
+import requests
8
9
class Game:
10
def __init__(self):
11
self.grid = []
12
for _ in range(9):
13
self.grid.append(random.choice(string.ascii_uppercase))
14
def is_valid(self, word):
- if not word:
15
- return False
16
- letters = self.grid.copy() # Consume letters from the grid
17
- for letter in word:
18
- if letter in letters:
19
- letters.remove(letter)
20
- else:
21
22
- return True
+ return self.__check_dictionary(word)
+ @staticmethod
+ def __check_dictionary(word):
+ response = requests.get(f"https://wagon-dictionary.herokuapp.com/{word}")
+ json_response = response.json()
+ return json_response['found']
23
tests/__pycache__/test_game.cpython-38.pyc
226 Bytes
0 commit comments