Be the first to rate this file! 5 Downloads (last 30 days) File Size: 82.76 KB File ID: #32001
image thumbnail

Cows and Bulls

by Y Vineel

 

29 Jun 2011 (Updated 05 Aug 2011)

The code is a naive implementation of the deductive game Cows and Bulls also known as MOO.

| Watch this File

File Information
Description

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

MATLAB release MATLAB 7.10 (2010a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
02 Aug 2011 Sean de

It looks fun but the way the figure opens, my guesses tables is off the edge and the figure is non-resizable. I'll wait to rate until this is done since it's not in a usable form right now.

05 Aug 2011 Y Vineel

@ Sean de: I have updated the game and the new one will be appearing soon. Check it out and comment

Please login to add a comment or rating.
Updates
08 Jul 2011

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

05 Aug 2011

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

Tag Activity for this File
Tag Applied By Date/Time
cows and bulls recreational Y Vineel 29 Jun 2011 11:10:32
games Y Vineel 01 Jul 2011 13:09:53
game Y Vineel 01 Jul 2011 13:09:53
moo Y Vineel 01 Jul 2011 13:09:53
cows and bulls Y Vineel 01 Jul 2011 13:09:53
mastermind Y Vineel 01 Jul 2011 13:09:53
cows and bulls Erhan 07 Oct 2011 13:15:05

Contact us at files@mathworks.com