Code Monkey home page Code Monkey logo

hangman's People

Contributors

alexmathew avatar aswinm avatar bravegnu avatar gnurenga avatar hrishikeshsathe avatar likandia avatar praba230890 avatar shrayasr avatar sriki18 avatar vamsi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hangman's Issues

Add classifiers to setup.py

Add classifiers to setup.py to indicate the topic, supported Python versions, license and development status.

2 Player mode

Can we add an option to play two player over a network?

Re-organize code to use OOP

The current design craves for an OOP implementation. For example look at the init() function, and how the only choice is to return a tuple. Also the game state is being passed to every function. It will better to create a Hangman class that has the following private attributes: missedLetters, correctLetters, secretWord, gameIsDone, representing the game state. The other functions except main() will be made methods of this class. The main() will be public and the rest can remain private.

The Hangman class instance could represent only one execution of the game. So playAgain() can be kept outside the class. Everytime the user plays a new game a new instance of the class will be created.

Refactor main() function

The main() function is suffering from code bloat. Should be split into multiple sub functions. One approach is to have 3 functions:

  • init() to initialize / re-initialize the game state.
  • check_win() to check and print messages, if user has won.
  • check_lose() to check and print messages, if user has lost.

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.