Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhrankan-Chakrabarti authored Jun 24, 2024
1 parent 650bab1 commit 230961e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions HangmanGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ class Hangman:

def __init__(self):

self.turns = 11
self.photos = [PhotoImage(file = f"images/hang{i}.png") for i in range(self.turns)]
self.total_turns = 11
self.photos = [PhotoImage(file = f"images/hang{i}.png") for i in range(self.total_turns + 1)]

def new_game(self):

self.turns = 11
self.turns = self.total_turns

with open("dictionary.txt") as f:

self.word, self.guesses, self.failed = choice(f.read().split('\n')), [], 1
hang["image"] = ""
self.word, self.guesses, self.failed = choice(f.read().upper().split('\n')), [], 1
self.draw_hang()

self.generate("", True, f"Guess the {len(self.word)} letter word. Good luck!", "yellow")

Expand Down

0 comments on commit 230961e

Please sign in to comment.