Splinterlands Hangman with holoz0r - a development in Python

in Splinterlands3 years ago

A few days ago, I said that I was starting to learn Python. I am doing exactly that.

<p dir="auto"><img src="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/holoz0r/EnyoS3bPiYEbCRZVzFvjjzQs4JQQxqvwfRqHnKxsB6M5yQ5J8ZrNSWTU1UYarzSA4ot.png" alt="image.png" srcset="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/holoz0r/EnyoS3bPiYEbCRZVzFvjjzQs4JQQxqvwfRqHnKxsB6M5yQ5J8ZrNSWTU1UYarzSA4ot.png 1x, https://images.hive.blog/1536x0/https://files.peakd.com/file/peakd-hive/holoz0r/EnyoS3bPiYEbCRZVzFvjjzQs4JQQxqvwfRqHnKxsB6M5yQ5J8ZrNSWTU1UYarzSA4ot.png 2x" /> <p dir="auto">I have published this game on <a href="https://github.com/holoz0r/SplinterlandsHangman" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">GitHub, and while it has many issues, Please remember that I am at day 7 of my journey to learning Python. <p dir="auto">I might come back to this project as I get better, and improve upon it; but for the time being, it is a fun little project built out from the skeleton of the course I am following. <p dir="auto">If you're a crazy experienced developer, please poke holes in my code and tell me why and how it can be improved. I'd love to know! <pre><code>import random from hangmanart import * from hangmanwords import word_list end_of_game = False chosen_word = random.choice(word_list) word_length = len(chosen_word) lives = 6 print(logo) #Testing code # print(f'Pssst, the solution is {chosen_word}.') display = [] for _ in range(word_length): display += "_" while not end_of_game: guess = input("Guess a letter: ").lower() for position in range(word_length): letter = chosen_word[position] if letter == guess: display[position] = letter if guess not in chosen_word and lives >0: lives -= 1 print(f"You have {lives} lives left.") if lives == 0: end_of_game = True print("You Lose!") print(f"The Correct answer was {chosen_word}.") print(f"{' '.join(display)}") if "_" not in display: end_of_game = True print("You win.") print(stages[lives]) <p dir="auto"><img src="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/holoz0r/Eo1wMUJgRgeUymF3YdpjU4Upydpo8VKHT5tbY8WWevZwUBJufSvYc5pFar5kTC4wJ3C.png" alt="image.png" srcset="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/holoz0r/Eo1wMUJgRgeUymF3YdpjU4Upydpo8VKHT5tbY8WWevZwUBJufSvYc5pFar5kTC4wJ3C.png 1x, https://images.hive.blog/1536x0/https://files.peakd.com/file/peakd-hive/holoz0r/Eo1wMUJgRgeUymF3YdpjU4Upydpo8VKHT5tbY8WWevZwUBJufSvYc5pFar5kTC4wJ3C.png 2x" /> <p dir="auto">Until next time... <hr /> <center><h4>Want more holoz0r and Splinterlands?<br /> <div class="pull-left"><span><img src="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/holoz0r/AK2BjKGGLBFTBPhtsWKMnsmFFJDQrhXbbM35f6dRxoT4fEqqegsPLWdwizYRNxw.png" srcset="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/holoz0r/AK2BjKGGLBFTBPhtsWKMnsmFFJDQrhXbbM35f6dRxoT4fEqqegsPLWdwizYRNxw.png 1x, https://images.hive.blog/1536x0/https://files.peakd.com/file/peakd-hive/holoz0r/AK2BjKGGLBFTBPhtsWKMnsmFFJDQrhXbbM35f6dRxoT4fEqqegsPLWdwizYRNxw.png 2x" /><br />If you want to see my Splinterlands antics and rants live, Find me on <a href="https://www.twitch.tv/holoz0r" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Twitch<br /><br /> <p dir="auto">If you prefer sleeping in your designated time zone, <a href="https://www.youtube.com/channel/UCuupHoy5KyWOjRbqIY5F4HA" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">go watch replays on YouTube.<br /><br /> <p dir="auto"><a href="https://splinterlands.com?ref=holoz0r" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">If you haven't started playing Splinterlands, you should do that immediately. It's very good fun.<br /> <p dir="auto"><a href="https://www.youtube.com/watch?v=hu8eFSUIFTs&list=PLBqiQz1Xjoxv06-zmi2cYURz0AI-jI0x4" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Go and watch me open season rewards and packs on YouTube! <hr /> <p dir="auto"><center><h4>Want more content from me? <p dir="auto"><a href="https://peakd.com/ccc/holoz0r/holoz0rs-a-z-of-steam-a-complete-archive-to-date" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Witness my futile efforts to play my Steam Game collection in alphabetical order. <p dir="auto">Are you aware that I love photography? <a href="https://peakd.com/ccc/holoz0r/photographic-works-and-ramblings-of-holoz0r" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Check out my work in a collection. <hr /> <p dir="auto"><center>Thanks as always for your time!
Sort:  
Loading...

Fun game and great job.

Thanks mate! Need to get a lot better at coding to make some more creative things! :D