/bulls_and_cows

Java CLI Project: Bulls and Cows

Primary LanguageJava

Bulls and Cows

demo: https://replit.com/@holakele/bullsandcows

Description

Bulls and Cows (also known as Cows and Bulls or Pigs and Bulls) is an old code-breaking mind or paper and pencil game for two or more players, predating the commercially marketed board game Mastermind.

It is a game that may date back a century or more which uses numbers or words. It is played by two opponents.

The numerical version

The numerical version of the game is usually played with 4 digits, but can also be played with 3 or any other number of digits.

On a sheet of paper, the players each write a 4-digit secret number. The digits must be all different. Then, in turn, the players try to guess their opponent's number who gives the number of matches. If the matching digits are in their right positions, they are "bulls", if in different positions, they are "cows". Example:

Secret number: 4271

Opponent's try: 1234

Answer: 1 bull and 2 cows. (The bull is "2", the cows are "4" and "1".)

The first one to reveal the other's secret number in the least number of guesses wins the game.

source: Wikipedia

Run

To run program type in the console:

java -jar out/artifacts/bulls_and_cows_jar/bulls_and_cows.jar

or hit "Run" button.

PrintScreen

pic start 1