We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ab418fa + 2b95f01 commit be923e6Copy full SHA for be923e6
1 file changed
games/Number-Guessing-Game/Number-Guessing-Game.py
@@ -17,6 +17,13 @@
17
MIN_NUMBER = 1
18
MAX_NUMBER = 100
19
20
+# Difficulty configuration
21
+DIFFICULTY_ATTEMPTS = {
22
+ "1": 15,
23
+ "2": 10,
24
+ "3": 5,
25
+}
26
+
27
# Proximity hint thresholds
28
VERY_CLOSE_THRESHOLD = 3
29
CLOSE_THRESHOLD = 10
@@ -39,12 +46,7 @@ def main() -> None:
39
46
error_invalid="⚠️ Invalid selection. Please enter 1, 2 or 3."
40
47
)
41
48
42
- if choice == "1":
43
- max_attempts = 15
44
- elif choice == "3":
45
- max_attempts = 5
- else:
- max_attempts = 10
49
+ max_attempts = DIFFICULTY_ATTEMPTS[choice]
50
51
number = random.randint(MIN_NUMBER, MAX_NUMBER)
52
attempts = 0
@@ -118,4 +120,4 @@ def main() -> None:
118
120
if __name__ == "__main__":
119
121
if len(sys.argv) > 1:
122
random.seed(int(sys.argv[1]))
- main()
123
+ main()
0 commit comments