Cows and Bulls

Version 1.4.0.0 (82,8 KB) von Y Vineel
The code is a naive implementation of the deductive game Cows and Bulls also known as MOO.
422 Downloads
Aktualisiert 5. Aug 2011

Lizenz anzeigen

The players(the computer and you) think of a secret three digit number using digits from 1 to 9 without any repetitions.
The objective of the game is to guess the opponent's secret number first by taking turns. The number of cows in a guess is the number of digits that are in the guess and also in the opponent's secret number but are in different positions. The number of bulls in a guess is the number of digits that are in the guess and also in the opponent's secret number and also are in the same position.

eg 1: secret number: 625
Guess: 165
cows = 1 bulls = 1

eg 2: secret number: 986
Guess: 896
cows = 2 bulls = 1

The guesses made by the computer and the player are logged in the GUI in the two tables provided along with the corresponding number of cows and bulls(See attached screenshot).

Zitieren als

Y Vineel (2024). Cows and Bulls (https://www.mathworks.com/matlabcentral/fileexchange/32001-cows-and-bulls), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2010a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Just for fun finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise
1.4.0.0

The layout has been modified a bit. A .exe file has also been included for quick-play.

1.2.0.0

There was a mistake in the second example and it has been corrected.

1.0.0.0