GithubHelp home page GithubHelp logo

psette / mastermind Goto Github PK

View Code? Open in Web Editor NEW

This project forked from travman89/mastermind

0.0 1.0 0.0 15 KB

Small text based representation of the game Mastermind written in python

Python 100.00%

mastermind's Introduction

Mastermind

Small text based representation of the game Mastermind written in python

#How to Play Mastermind is a code breaking game where the player is tasked with breaking a code by using clues given to them by the other player. This rendition of the game generates a code that is 4 characters long and consists of the letters [a,b,c,d,e,f]. Codes can have multiples of the same letter, so while a code could be 'fced' it could also be 'aaaa'. After you guess the computer player will give you a hint representing how close you got to guessing the correct code. A '*' means that you have guessed a letter correctly and in the correct order in the code. A '/' means that you have guessed a letter correctly, but it is in the wrong spot. Let's look at an example of how the computer's algorithm generates the hints.

For this example we will be using the computer generated code of 'bdcd'.

For our first guess we will enter in 'abcd'. The computer will spit back ['*','/','/'] since we guessed only 1 letter correctly in its correct spot and 2 more letters correctly in incorrect spots. We will now use this information to further narrow down our code guesses.

For our next guess we will enter in 'eeee'. The computer will spit back [] as the hint since the code does not contain any 'e' characters. We can now eliminate 'e' from all of our future guesses.

After several rounds of guessing you should be honing in on the correct code, and once you have broken it, the computer will signal that you have won.

#Setup The game is written in python, so to play simply navigate to the mastermind directory and run the following command:

python mastermind.py

If you are using python 3.x.x the game can be run by changing raw_input to input and surrounding the print statement of win_message to be surrounded by () inside helpers.py

mastermind's People

Contributors

travman89 avatar

Watchers

James Cloos 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.