{"id":346,"date":"2023-12-04T05:51:02","date_gmt":"2023-12-04T05:51:02","guid":{"rendered":"https:\/\/andrewjwhittle.com\/wp-lotpnet\/?p=346"},"modified":"2023-12-04T05:51:02","modified_gmt":"2023-12-04T05:51:02","slug":"python-hangman-game","status":"publish","type":"post","link":"https:\/\/andrewjwhittle.com\/wp-lotpnet\/2023\/12\/04\/python-hangman-game\/","title":{"rendered":"Python Hangman game"},"content":{"rendered":"\n<p>I wrote this a few years ago while I was going through the projects on inventwithpython.com and this one interested me beyond just following along. You start in chapter 8 (http:\/\/inventwithpython.com\/invent4thed\/chapter8.html) making a hangman game with ASCII art and a list of words. Chapter 9 (http:\/\/inventwithpython.com\/invent4thed\/chapter9.html) expands it with multiple difficulty settings and word options.<\/p>\n\n\n\n<p>The code for those 2 parts are linked but I wanted to take it further. I started thinking that there must be a bunch of text files out there with all English words. I figured there would be a dictionary or Webster\u2019s.txt but I haven\u2019t found one. I found many files with 10\u2019s to 100\u2019s of thousands of words, so I grabbed one and started playing.<\/p>\n\n\n\n<p>https:\/\/github.com\/dwyl\/english-words<br>https:\/\/sites.google.com\/a\/vhhscougars.org\/johnsearch\/searchindex\/oxford-english-dictionary<br>http:\/\/www.gwicks.net\/dictionaries.htm<\/p>\n\n\n\n<p>All that had to change was to make the words variable open the file words = list(open(&#8216;words_alpha.txt&#8217;)) instead of putting the list directly in the code as a list, or dictionary, depending on which chapter you\u2019re working on. It\u2019s a small change code-wise but it opens up the game to new possibilities.<\/p>\n\n\n\n<p>I\u2019m having problems finding lists of specific words but I\u2019d like to build on chapter 9 and have topics, and maybe hints. The hints could be in the file or be scrapped from search engine results.<\/p>\n\n\n\n<p>If I continue to work on it here\u2019s the Gitlab https:\/\/gitlab.com\/andrewjwhittle\/hangman<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wrote this a few years ago while I was going through the projects on inventwithpython.com and this one interested me beyond just following along. You start in chapter 8 (http:\/\/inventwithpython.com\/invent4thed\/chapter8.html) making a hangman game with ASCII art and a list of words. Chapter 9 (http:\/\/inventwithpython.com\/invent4thed\/chapter9.html) expands it with multiple difficulty settings and word options. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[43,32],"tags":[],"class_list":["post-346","post","type-post","status-publish","format-standard","hentry","category-python","category-scripting"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/andrewjwhittle.com\/wp-lotpnet\/wp-json\/wp\/v2\/posts\/346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/andrewjwhittle.com\/wp-lotpnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/andrewjwhittle.com\/wp-lotpnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/andrewjwhittle.com\/wp-lotpnet\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/andrewjwhittle.com\/wp-lotpnet\/wp-json\/wp\/v2\/comments?post=346"}],"version-history":[{"count":1,"href":"https:\/\/andrewjwhittle.com\/wp-lotpnet\/wp-json\/wp\/v2\/posts\/346\/revisions"}],"predecessor-version":[{"id":347,"href":"https:\/\/andrewjwhittle.com\/wp-lotpnet\/wp-json\/wp\/v2\/posts\/346\/revisions\/347"}],"wp:attachment":[{"href":"https:\/\/andrewjwhittle.com\/wp-lotpnet\/wp-json\/wp\/v2\/media?parent=346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/andrewjwhittle.com\/wp-lotpnet\/wp-json\/wp\/v2\/categories?post=346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/andrewjwhittle.com\/wp-lotpnet\/wp-json\/wp\/v2\/tags?post=346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}