Spaces:
Build error
Build error
Yoann
commited on
Commit
·
86bd978
1
Parent(s):
963fdfb
Changing guessing condition
Browse files- __pycache__/sentence.cpython-39.pyc +0 -0
- sentence.py +3 -3
__pycache__/sentence.cpython-39.pyc
CHANGED
|
Binary files a/__pycache__/sentence.cpython-39.pyc and b/__pycache__/sentence.cpython-39.pyc differ
|
|
|
sentence.py
CHANGED
|
@@ -92,7 +92,7 @@ def updateState(var_dict, preds):
|
|
| 92 |
### Check if the current part has been guessed
|
| 93 |
part = var_dict["parts"][var_dict["step"]]
|
| 94 |
|
| 95 |
-
|
| 96 |
idx_of_nothing = -1
|
| 97 |
if ("nothing" in preds[0]): idx_of_nothing = 0
|
| 98 |
elif ("nothing" in preds[1]): idx_of_nothing = 1
|
|
@@ -102,9 +102,9 @@ def updateState(var_dict, preds):
|
|
| 102 |
if (part["classes"][-1] == preds[0]): idx_of_guess = 0
|
| 103 |
elif (part["classes"][-1] == preds[1]): idx_of_guess = 1
|
| 104 |
elif (part["classes"][-1] == preds[2]): idx_of_guess = 2
|
| 105 |
-
'''
|
| 106 |
|
| 107 |
-
|
|
|
|
| 108 |
var_dict["step"] += 1
|
| 109 |
var_dict["found_words"].append(part["word"])
|
| 110 |
var_dict["win"] = var_dict["step"] == len(var_dict["parts"])
|
|
|
|
| 92 |
### Check if the current part has been guessed
|
| 93 |
part = var_dict["parts"][var_dict["step"]]
|
| 94 |
|
| 95 |
+
|
| 96 |
idx_of_nothing = -1
|
| 97 |
if ("nothing" in preds[0]): idx_of_nothing = 0
|
| 98 |
elif ("nothing" in preds[1]): idx_of_nothing = 1
|
|
|
|
| 102 |
if (part["classes"][-1] == preds[0]): idx_of_guess = 0
|
| 103 |
elif (part["classes"][-1] == preds[1]): idx_of_guess = 1
|
| 104 |
elif (part["classes"][-1] == preds[2]): idx_of_guess = 2
|
|
|
|
| 105 |
|
| 106 |
+
|
| 107 |
+
if not var_dict["win"] and (idx_of_guess > idx_of_nothing):
|
| 108 |
var_dict["step"] += 1
|
| 109 |
var_dict["found_words"].append(part["word"])
|
| 110 |
var_dict["win"] = var_dict["step"] == len(var_dict["parts"])
|