GithubHelp home page GithubHelp logo

cmcs0157 / itp-u4-c2-hangman-game Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phoebejinx/itp-u4-c2-hangman-game

0.0 1.0 0.0 13 KB

Hangman Game Practice Project

Home Page: https://rmotr.com/introduction-to-python-programming

License: MIT License

Python 100.00%

itp-u4-c2-hangman-game's Introduction

Watch the intro and explanation for this project!
(YouTube Link)


Hangman Game

Today we are going to re-create the game 'Hangman' in Python!

It is broken down into several small functions that, when combined and completed, form a working game!

We're providing the main function start_new_game, that just relies on your other smaller functions to work.

These are the functions that you have to implement:

Mask Word

$ py.test tests.py -k mask_word

Given a word like 'Python', it returns it "masked" (replacing real characters with asterisks): '******'

Uncover Word

$ py.test tests.py -k uncover_word

This is probably one of the most challenging ones (it has many exceptional cases). Given an answer word (like 'Python') a masked word (like '******' or '*y****') and a guessed letter ('n' for example) it returns a new masked word replacing the asterisks with the guessed letter IF the letter is present in the word to answer. Examples:

_uncover_word('Python', '******', 'y')  # '*y****'  # Match
_uncover_word('Python', '*y****', 'n')  # '*y***n'  # Match

_uncover_word('Python', '******', 'x')  # '******'  # Miss
_uncover_word('Python', '*y****', 'x')  # '*y****'  # Miss

Get Random Word

$ py.test tests.py -k get_random_word

Receives a list of words and returns one from the list randomly.

Guess Letter

$ py.test tests.py -k guess

Probably the most "important" (or "general") function. We recommend you to deal with this function after you've completed the other ones.

It receives a game object and a letter to guess. It has several different scenarios. For example, the guessed word is a match or a miss, the game is won or lost, or the game was already over.

itp-u4-c2-hangman-game's People

Contributors

cmcs0157 avatar ivanzugnoni avatar santiagobasulto avatar

Watchers

 avatar

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.