chennaipy / hangman Goto Github PK
View Code? Open in Web Editor NEWImproves upon the Hangman game, from the book "Invent Your Own Computer Games with Python".
License: BSD 2-Clause "Simplified" License
Improves upon the Hangman game, from the book "Invent Your Own Computer Games with Python".
License: BSD 2-Clause "Simplified" License
Add underscore prefix to all private methods and attributes.
Add PyPI shields / badges to indicate supported Python versions and license. Documentation available at https://pypip.in/ Depends on #22
Write a setup.py script to package and distribute the application.
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.
Add classifiers to setup.py to indicate the topic, supported Python versions, license and development status.
All functions private or public deserve a oneline docstring, describing it.
Run pep8
, identify style issues in the code, and fix them.
Setup TravisCI to run the tests on every commit.
Add a changelog file based on https://github.com/bitprophet/releases
Can we add an option to play two player over a network?
Build and upload the documentation to Read The Docs.
Eliminate getRandomWord()
use random.choice()
instead.
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.For function names, method names, attribute names and local variable names use underscore to separate words, instead of camelCase.
Add a long description to setup.py based on README.rst This will appear as a package description on PyPI.
Support both python versions 2 and 3 in the same code base.
Currently, after installation the script is executed as follows, with a .py
extension.
$ gallows.py
Need to autogenerate an entry point script without extension, that can invoke the gallows.py
module. For more information try reading http://stackoverflow.com/questions/14596057/distributing-python-scripts-without-py-extension
Update README, to reflect current usage and development procedures.
Display the code coverage using coveralls.io Documentation is available at https://github.com/z4r/python-coveralls
Modify .travis.yml
to automatically upload package to PyPI on tagging a release. See http://docs.travis-ci.com/user/deployment/pypi/ for details.
Display the TravisCI build status in the README file. Documentation is available at http://docs.travis-ci.com/user/status-images/
Convert README file from markdown format to ReStructuredText. This is required so that the README file can be displayed on PyPI, as a long description. Instructions available at http://www.scotttorborg.com/python-packaging/metadata.html
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.