Giter VIP home page Giter VIP logo

hangman-game-reloaded's Introduction

Hangman-Game-Reloaded

It uses an English Dictionary in JSON format. The program chooses a random word from around 499,000 words and gives the definition of the word as a hint. The player has to guess the word within 10 trials before a kind man is killed.

hangman-game-reloaded's People

Contributors

pavithra-rajan avatar

Watchers

 avatar

hangman-game-reloaded's Issues

Develop GUI

Try tkinter or pygame for making a basic GUI. Makes it more user friendly than ipynb and terminal. Another good exercise.

correct the game logic

Make sure game logic is correct before you do anything else!

For example, if I've guessed a letter, I shouldn't be allowed to guess it again. That's unnecessary penalizing. Do more input validation other than checking 'a-z'. Think that the user may be able to press any key they want so make sure your program can react accordingly.

[long term] PEP8 compliant code

PEP8 is a standard for styling for python code. This may not even be an existent issue, but just check it out for yourself

[minor] refactor code

Minor issues that you can ignore for the time being, but I feel they might be better practices

cond='y'

while(cond=='y'):
    if meaning=="'ISO 639-6 entity'":
        word, meaning = random.choice(list(data.items()))
        meaning=str(meaning).strip('[]')
        for l in word:
            if l not in validLetters:
                word, meaning = random.choice(list(data.items()))
                meaning=str(meaning).strip('[]')
    else:
        cond='n'

Instead of using 'cond' var, you can just use a while True and get it done

if turns == 9:
                print("9 turns left")
                print("  --------  ")
            if turns == 8:
                print("8 turns left")
                print("  --------  ")
                print("     O      ")

and so on...

You can easily condense this code in the loop and avoid rewriting statements whenever possible, you can try to reuse it, or relate it with the loop counter, for example, print(turns, "turns left") so that saves a lot of lines just like that. Think of a logic to condense that code and put it on a loop.

Off/On-line dictionary (read desc)

Give the user an option to either fetch dictionary words online if they have an internet connection, or they can download the dictionary if they want to play offline. It's not a big deal, but I want you to try out something new, i.e. how to fetch info from the internet thru a python script. Fetching dictionary from the internet may even give rise to more opportunities from there.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.