Giter Club home page Giter Club logo

mastermind-kata-kotlin's Introduction

Mastermind Kata

Mastermind is a code-breaking game for two players. The modern game with pegs was invented in 1970 by Mordecai Meirowitz, an Israeli postmaster and telecommunications expert. It resembles an earlier pencil and paper game called Bulls and Cows that may date back a century or more. (Source Wikipedia)

Game rules:

  • The Mastermind (computer) will select 4 colours. The colours are randomly selected from: "Red", "Blue", "Green", "Orange", "Purple", "Yellow". Colours can be duplicated but there will always be exactly 4.
  • You enter your guess (4 colours) and the Mastermind returns a result to you. For every correctly positioned colour an element (peg) of “Black” is returned. For every correct colour but in the wrong position an element of “White” will be returned.
  • Passing the correct combination will return "WON!".
  • You have 10 chances to guess the combination

App:

  • Build a console app
  • You have to enter each guess (4 colours) and the computer prints the result (blacks and whites)
  • If you reach the 10 attempts the program prints "GAME OVER" and exits
  • If you guess the number the program prints "YOU WON" and exits
  • If you enter invalid input (unknown colours or wrong length) the program prints an error

Examples:

Assuming correct combination is "red, blue, green, yellow"

Welcome to Mastermind! 
Try to guess the combination using the colours (red, blue, green, orange, purple, yellow):
> red, orange, yellow, orange
black, white

Assuming correct combination is "red, blue, green, orange"

Welcome to Mastermind! 
Try to guess the combination using the colours (red, blue, green, orange, purple, yellow):
> red, blue, yellow, green
black, black, white
> red, yellow, green, yellow
black, white

mastermind-kata-kotlin's People

Contributors

nbottarini 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.