Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C22 Phoenix - Guevara, Alejandra #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

222alle111
Copy link

No description provided.

Copy link
Contributor

@anselrognlie anselrognlie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added comments about the implementation so far. Please review them, and let me know if you have any questions. Slack, our next 1:1, or office hours are preferred (rather than replying to my comments in GitHub) as I don't have email notifications turned on. Keep at it!

Comment on lines +1 to +3
import random
from wonderwords import RandomWord
#https://pypi.org/project/wonderwords/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the random operations are performed out in the main.py. We shoudn't need either of these imports here.

from wonderwords import RandomWord
#https://pypi.org/project/wonderwords/

SNOWMAN_GRAPHIC = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Nice to see you swap over to the array-based snowman image.

'-----------'
]

SNOWMAN_WRONG_GUESSES = len(SNOWMAN_GRAPHIC)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use this instead of SNOWMAN_MAX_WRONG_GUESSES later in the code, since this is related directly to the actual snowman image data. Or, we could use this to initialize SNOWMAN_MAX_WRONG_GUESSES to minimize changes later in the code.

Comment on lines -13 to -20
def snowman(snowman_word):
"""Complete the snowman function
replace "pass" below with your own code
It should print 'Congratulations, you win!'
If the player wins and,
'Sorry, you lose! The word was {snowman_word}' if the player loses
"""
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could minimize the changes in the file by adding the snowman implementation here, rather than moving it later in the file.

game.py Outdated
Comment on lines 54 to 67
if i == 0:
print(SNOWMAN_GRAPHIC[0])
elif i == 1:
print(SNOWMAN_GRAPHIC[1])
elif i == 2:
print(SNOWMAN_GRAPHIC[2])
elif i == 3:
print(SNOWMAN_GRAPHIC[3])
elif i == 4:
print(SNOWMAN_GRAPHIC[4])
elif i == 5:
print(SNOWMAN_GRAPHIC[5])
elif i == 6:
print(SNOWMAN_GRAPHIC[6])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 These lines can be removed since you switched over to the array-based image data. This is currently causing the lines to be doubled when displaying the snowman.

game.py Outdated
print(f"Wrong guesses: {wrong_guesses_list}")

if user_input and correct_guesses_list:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 This will detect a won game as soon as there is a correct guess (user_input will be some letter, which is truthy, and correct_guesses_list will not be empty, which is also truthy). We only want to win if all the letters have been guessed. The get_word_progress function was supplied to help with that (but we need the word dict we'd get back from build_word_dict to be able to use that).

game.py Outdated
Comment on lines 112 to 113
print(f"The word was '{snowman_word}'.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 These losing messages will print every time through the loop rather than once at the end of a lost game. If the game is lost, the loop will end, so these should be unindented so that they are after the loop.

game.py Outdated
return
print("Sorry, you lose!")
print(f"The word was '{snowman_word}'.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 The losing message the test is looking for should not have quotes in it.

game.py Outdated

while len(wrong_guesses_list) < SNOWMAN_WRONG_GUESSES:
user_input = get_letter_from_user(wrong_guesses_list, correct_guesses_list)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 The word "stage" never prints (we can use print_word_progress_string to do this). This is important so the user can see where the letters they guessed end up in the word. This requires getting the word dictionary that would be built from calling build_word_dict at the start of the game.

main.py Outdated
unittest.main(exit=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This small stray edit cause the tests to always try to run even if the player picked "p" to play. Unindenting the line moves it out of the else and into code that runs after the whole condition (whether it was true or false). Watch out for stray changes. If we accidentally change a file, as long as we haven't staged it yet, we can revert it with git restore main.py, where main.py is the name of the file to revert the changes of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants