Bulls and Cows vs. MASTERMIND

General

You can play Bulls and Cows (= Cows and Bulls, MASTERMIND, SuperHirn) as browser-game (HTML5-game) or as download for DOS / DOSBox, Windows, Android, Apple Mac OS X / OS X / macOS, Linux, FreeBSD / PC-BSD / TrueOS / GhostBSD / NomadBSD and Solaris.

Bulls and Cows or Cows and Bulls is a logic-game for two players.
Bulls and Cows at Wikipedia. *
MASTERMIND or SuperHirn is the commercial implementation of the game on a breadboard.
MASTERMIND at Wikipedia. *

My game-program is also listed at: Many thanks  for that !

Many thanks also to the DOSBox-Crew * and the Free Pascal-Team * !

Rules and course of the game


The first player, the 'coder', thinks up a secret solution code,
a number-combination for Bulls and Cows, a colour-combination for MASTERMIND,
which the second player, the 'code-breaker', has to guess with as few attempts as possible.

To do this, the code-breaker thinks up his own combination and communicates it to the coder.
The encoder compares the two codes and informs the code-breaker of two numbers:
P indicates in how many Positions both codes match and
S indicates how many more Signs both codes have in common, but at a wrong position.
With the help of the coder's information, logical thinking and more attempts the code-breaker
tries to guess the solution code finally.

Example:
       2934 and
       2473
       only match in one position, namely the first position ('2').  =>  P = 1.
       In addition, both combinations once have the number '4' plus once the number '3' in common.  =>  Z = 1 + 1 = 2.

The program cannot only provide a solution but also guess and thus becomes a real opponent for humans.
So you can learn strategy and tactics from the program very well, e.g. good start codes, combinations of moves,
or when it makes sense to consciously use incorrect codes, even with characters that cannot appear in the solution code.
Example: character set a,b; length of the code >= 4; with spaces vs. without spaces.
But you can also (for learning and demonstration purposes) let the program play against itself or
play 'normal' with a friend, as you used to do without a computer or smartphone.
The program then monitors the game and only allows entries that conform to the rules.

The program can be started several times simultaneously - in the download version as well as online -
and you can play several games at the same time.
Depending on the operating system, the DOSBox program can also be started several times.
So you can, for example, play moves of the program from one game instance
take over and play as own moves in a second game instance.

Compared to the two original games, the game-program offers the following extensions:
  • freely selectable length of the code and freely selectable character set ('colours');
    option to allow or forbid repetitions
  • option to guess incomplete codes
  • option to play 'fair' or to 'cheat',
    i.e. the coder changes his solution code during the course of the game
    within the scope of the information he has already given,
    to make it as difficult as possible for his opponent.
    Note on this version:
    The code-breaker determines by its attempts the solution.
    Each game can be played again and again with always the same result.
    The images in the DOSBox simulation are developed that way.
    So there is an exchange between non-determinism and determinism
    (or vice versa, depending on the perspective) and 'entanglement'.
    In terms of the Heisenberg uncertainty principle, or 'Schrödinger's cat's'
    it is not clear when and where the solution comes from.
The program is bilingual, German and English.
In the program itself in the main menu under point 6 there are short instructions and
detailed instructions can be found under point 7 (in both languages).
The differences between the individual game variants are clearly explained there.
These instructions are included in the download versions and in the online version,
but also in the simulation on this website.

On another paradox should be noted at this point:
Guessing strategy is to reduce the amount of allowed solutions with each guessing process as much as possible,
cheating strategy is to keep this quantity as large as possible.
The presumption is that a smaller amount of solutions will ever result in a faster solution,
surprisingly, the proof is wrong.
Both strategies, however, are still successful.
In the case of length of the code = 6 and 6 allowed characters ('colours') there is an anomaly:
If repetitions of characters are allowed, the computer needs 6 attempts to find the solution.
If repetitions of characters are not allowed, the computer needs 7 attempts to find the solution.
A tremendous reduction in the size of the initial solution set from 6 ^ 6 = 46 656 elements to 6! = 720 elements
increases the number of the required attempts from 6 to 7.
Using this variant the problem could only be solved by allowing generally no repetitions of characters,
when the Computer was 'cheating'.
In order that it is not so noticeable, I have chosen different start codes.



'Bulls and Cows' has a version number in the format 'Year-Month-Day' of the last change.
The actual version is:

To play, you can choose between:

Bulls and Cows as browser-game:

   Start the browser-game (easy control)

   Start the browser-game (complex control)

   Browser-game on DOS Zone

 *

  • The most universal, flexible and simple method:
    Runs on any device and operating system in the web browser,
    without installing other programs / apps (like DOSBox),
    with only minimal configuration,
    with built-in on-screen keyboard and / or with physical keyboard.
  • Automatically always the latest version.
  • In portrait and landscape format.
    Screen size, content and appearance can be adjusted,
    also in the middle of the game (see pictures below).
  • In your usual Internet browser you can play several games in different
    browser tabs / windows at the same time, e.g. game and revenge.
  • Much faster browser-alternative especially for DOS-games:
    DOS.Zone-Browser for Android (only 64 bit) * (however only one game-instance can be started),
    DOS.Zone-Browser for Windows, Linux, macOS (each only 64 Bit) *.
  • The browser-game uses the DOS-emulation js-dos *.
  • More 1980+ DOS-browser-games on DOS Zone *.
The browser-version of Bulls and Cows was programmed and compiled with Borland Pascal 7.01.

Configuration of the browser-game   Browser-game already configured

Configuration of the browser-game

Use the control-bar on the left to configure the browser-game as shown in the pictures above.
You can then play the game with both your physical keyboard and
with the on-screen-keyboard and the additional control-buttons that are displayed:
  • 4 cursor-keys
  • BS    = Backspace
  • D      = DEL / Delete
  • ESC = Escape
  • CR / Enter
  • <, >  = toggle between the 4 sets of control-buttons
  • F      = Function-key F4 to stop the guessing process soon
                and capital letters for colour-selection
  • '   '   = space character (when guessing or input of the player's names)

  • More control-buttons:

  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • Y(es), J(a), N(o) / N(ein), E(nglish), D(eutsch)
If you play with a physical keyboard, the following function-keys are also available:
  • F1    = Link to this page (for help) in German
  • F2    = Link to this page (for help) in English
  • F3    = Start another online-game simultaneously
  • F4    = Stop the guessing process soon
Below you see 3 times the 'BC'-sign for 3 open windows / browser tabs:
this page and two open games.

Finally, you can switch to full-screen-mode and / or hide the control-bar on the left.

Here differently configured views on a smartphone in landscape format:

Landscape browser-game 1: full-screen-mode without side-control-bar without on-screen-keyboard
Landscape browser-game 1: full-screen-mode without side-control-bar without on-screen-keyboard

Landscape browser-game 2: window-mode with side-control-bar without on-screen-keyboard
Landscape browser-game 2: window-mode with side-control-bar without on-screen-keyboard

Landscape browser-game 3: full-screen-mode with side-control-bar with on-screen-keyboard
Landscape browser-game 3: full-screen-mode with side-control-bar with on-screen-keyboard

DOS.Zone-browser
DOS.Zone-browser


Installing the program DOSBox
(especially under Android and Windows)
and the DOS-versions of Bulls and Cows
(under Windows-32-bit also without DOSBox !!)

  • under Android, OS/2 and RISC OS mostly the only possibility of an installation
  • advantages in the display (window size, graphic characters, line breaks)
  • offers additional options through the DOSBox program itself
  • language packs for DOS
  • different keyboard layouts: best: 'auto' for automatic setting
  • a great number of free DOS games for download on the Internet
  • possibility to install a DOSBox front end:
    • for a graphical DOSBox configuration without a configuration file
    • to manage several games with different search criteria and descriptions
      and also different configurations (e.g. graphics card, etc.)
    • with additional functions

  • Installation:

    After installing DOSBox, configure the DOSBox configuration file as follows
    or make the appropriate settings in the graphical front end:
    memsize=63 (or 64), core=auto, cputype=auto, cycles=auto, xms=true, ems=true, umb=true, keyboardlayout=auto.
    Therefore the Windows configuration as described in the BC.EXE or README.EXE program is not required.

    If you do not use a graphical frontend:
    Start DOSBox and make the directory with the BC.EXE file accessible in the DOSBox using the mount command,
    change to this directory and start Bulls and Cows with the command BC.EXE.
    All DOSBox commands such as mount are explained in the DOSBox program itself.

    Simulation with instructions of the game Bulls and Cows in the DOSBox version.

    The DOS/DOSBox-version of Bulls and Cows was programmed and compiled with Borland Pascal 7.01.

A suitable download for the respective operating system:

   Android           Windows           Linux + FreeBSD           macOS           Solaris

  • Just download, no installation effort,
    only the user rights have to be set to executable:
    • Windows:
      • Click away the warning messages:
        'Allow' or 'Additional information' -> 'Execute anyway'
    • otherwise:
      • Change the program properties -> user rights
        or
        in the terminal with the command 'chmod 755 ...'
    Please ensure that the window is large enough: 25 lines of 80 characters each,
    otherwise there may be problems with line breaks.
    Start the program from the terminal and select option 8 for the configuration in the main menu.
  • One version with graphic symbols and
    one version without graphic symbols,
    if the display causes difficulties.
  • Each as a 32-bit version and as a 64-bit version.
    The 64-bit version offers at minimum 16 GB RAM the (theoretical) advantage
    of being able to play even more game variants,
    but at the price of a disproportionately high storage requirement,
    see comparison of operating systems.

Bulls and Cows for Android



Important!
As a rule, you do not have root-rights on an Android-device.
Then you cannot install the Android-versions of Bulls and Cows.
The best option is the DOSBox version or the browser-game.

However, if you have root rights, e.g. on a rooted smartphone,
you can also install the Android version:
Install a terminal-emulator *.
As a virtual keyboard is Hacker's Keyboard * optimal, with all the necessary special characters.
A useful helper is Total Commander * (with built-in editor).
Choose the suitable program for your CPU (i386+x64 for Intel and AMD, arm+arm64 for most mobile phones). Please copy the downloaded program into the directory /data/local/tmp
set the user rights there to 'Executable' with the command 'chmod 755 ...'.
Start the program from the terminal and select option 8 for the configuration in the main menu.
The Android-versions of Bulls and Cows were compiled with Free Pascal *.


Bulls and Cows for Windows



Important!
You can play Bulls and Cows also within DOSBox,
as browser-game or within a
virtual computer with the operating system Linux.
Linux is much faster and DOSBox offers more options.
Under 32-bit-Windows the DOS-versions of Bulls and Cows
also run without DOSBox.

Please click warnings from the operating system away with 'Allow'
respectively 'More informations' -> 'Still execute'.
Start the program from the terminal and select option 8 for the configuration in the main menu.

Please choose 'Use Legacy console' and the 'Raster Font'
only with the program version with graphic characters.
To enjoy the game really you need also suitable
Fonts from Uwe Sieber, OEM Codepage 850 *.

The Windows-versions of Bulls and Cows were compiled with Free Pascal *.

Configuration Windows

Properties of 'bc-windows': Options   Properties of 'bc-windows': Fonts

Properties of 'bc-windows': Layout   Properties of 'bc-windows': Colors


Bulls and Cows for Linux + FreeBSD



After download please set the user rights 'Executable'.
Please start your terminal, increase it to maximum size of the window,
respectively choose the profile settings of the terminal and set the terminal size 80 coloums and 25 lines.
Start the program from the terminal and select option 8 for the configuration in the main menu.
The Linux- and FreeBSD-versions of Bulls and Cows were compiled with Free Pascal *.

Configuration Linux

Bulls and Cows for Apple Mac OS X / OS X / macOS



After download please set the user rights of bc-macos(64) respectively bc-macos(64)-ascii 'Executable'.
Start the program from the terminal and select option 8 for the configuration in the main menu.
The macOS-versions of Bulls and Cows were compiled with Free Pascal *.

Configuration macOS

Bulls and Cows for Solaris



After download please set the user rights of bc-solaris respectively bc-solaris-ascii 'Executable'.
Please start your terminal, increase it to maximum size of the window.
Start the program from the terminal and select option 8 for the configuration in the main menu.
The Solaris-versions of Bulls and Cows were compiled with Free Pascal *.

Configuration Solaris

The installation within a virtual Linux operating system
(especially under Windows)


Using VirtualBox (or VMware Workstation Player) as virtualization-software.

Please refer to the table below for the download-links suitable for your system.

Background:
  • The Linux-version of Bulls and Cows is much faster than the Windows-version
    and therefore offers the most game variants.
    It also offers advantages in terms of display (window size, graphic characters, fonts).
  • I have the best experiences with Windows 10 with the following installation:
  • As a 'side effect', a completely new second operating system is available to you,
    with a great number of games and other applications, that you only need to select
    in the application management or in the package management.
In order to test the game with more complex tasks, I needed a computer
with Linux as the operating system and 256 GiB main memory.
This was not feasible with either my physical computer or the virtual computers installed on it.
The solution to the problem was a virtual machine in the cloud: a Google Compute Engine.
A minimal installation of the virtual operating system (Linux Ubuntu in my case)
without a graphical interface, VNC, web server or other services/servers, just the console
is completely sufficient and most suitable.
The easiest way to establish the SSH connection is in the browser-window of the Chrome-browser.


Or you can try out several of the options mentioned parallel:

Installation options under the different operating systems (in each case in addition to the browser-version):
Used
operating sytem:
DOS &
Win 3.11
Windows 32 bit Windows 64 bit Android 32 bit Android 64 bit OS/2
RiscOS
Executable
versions of
Bulls and Cows:
DOS
(BC.EXE&
BCR.EXE)
DOS
(BC.EXE &
BCR.EXE)
Windows 32 bit



Windows 32 bit
Windows 64 bit



Android 32 bit***

*** !! only with
root rights !!



Android 32 bit***
Android 64 bit***

*** !! only with
root rights !!
---
DOSBox: --- Download * Download * Download:
selection *
recommended:
Magic DOSBox *
Download:
selection *
recommended:
Magic DOSBox *
Download *
DOSBox-
frontend:
--- Download:
D-Fend
Reloaded
 *
Download:
D-Fend
Reloaded
 *
integrated into:
Magic DOSBox *
integrated into:
Magic DOSBox *
---
DOS.Zone-
Browser
--- --- Download * --- Download * ---
VirtualBox:

Linux-Download:
--- Version 5.2.x *

Linux 32 bit *
current version *

Linux 64 bit *
--- --- ---
VMware Player:

Linux-Download:
--- --- Download *

Linux 64 bit *
--- --- ---

Installation options under the different operating systems (in each case in addition to the browser-version):
Used
operating sytem:
macOS
until
Mojave
macOS
from
Catalina
Linux
32 bit
Linux
64 bit
FreeBSD
32 bit
FreeBSD
64 bit
Solaris
32 bit
Solaris
64 bit
Executable
versions of
Bulls and Cows:
mac32
mac64

mac64
Linux32 Linux32
Linux64
FreeBSD32 FreeBSD32
FreeBSD64
Solaris32 Solaris32
DOSBox: Download * Download * package
manage-
ment
package
manage-
ment
over ports over ports --- ---
DOSBox-
frontend:
Download:
boxer * or
Dapplegrey *
Download:
boxer *
--- --- --- --- --- ---
DOS.Zone-
Browser
Download * Download * --- Download * --- --- --- ---
VirtualBox:


Linux-Download:
current
version
 *

Linux64 *
current
version
 *

Linux64 *
version
5.2.x
 *

Linux32 *
current
version
 *

Linux64 *
--- --- version
5.2.x
 *

Linux32 *
current
version
 *

Linux64 *
VMware Player:

Linux-Download:
--- --- --- Download *

Linux64 *
--- --- --- ---


Compare different operating systems

In order to guess, the computer has to request main memory (RAM), the more complex the task, the more memory.
The table shows how powerful the individual operating systems are (regardless of the time required):

Maximum size of the character set (number of 'colours'), depending on the operating system, RAM
and the length of the code to be guessed (by the computer !).
Length of the code to be guessed: 2 3 4 5 6 7 8 9 Maximum RAM:
Operating system used:
DOS/DOSBox: DOS - Real Mode 36 23 11 7 5 4 3 3   3^9 =             19 683 640 KiB
DOS/DOSBox + browser-game: DPMI 36 36 33 17 11 8 6 5   8^7 =        2 097 152 64 MiB
Windows+Solaris - Bulls and Cows 32 bit 36 36 36 31 17 12 8 7   7^9 =      40 353 607 2 GiB
Linux+macOS+BSD - Bulls and Cows 32 bit 36 36 36 31 18 13 9 7 13^7 =      62 748 517 2 GiB
Windows, Linux, macOS, FreeBSD - 64 bit
64-bit
-version of Bulls and Cows

needs much more memory
than Bulls and Cows 32 bit
36 36 36 29 16 11 8 6 29^5 =      20 511 149 2 GiB
36 36 36 33 18 12 9 7   9^8 =      43 046 721 4 GiB
36 36 36 35 21 13 9 7 21^6 =      85 766 121 8 GiB
36 36 36 36 23 15 10 8 15^7 =    170 859 375 16 GiB
36 36 36 36 26 16 11 8 26^6 =    308 915 776 32 GiB
36 36 36 36 29 18 12 9 18^7 =    612 220 032 64 GiB
36 36 36 36 33 20 13 10 33^6 = 1 291 467 969 128 GiB
36 36 36 36 35 21 14 10 35^6 = 1 838 265 625 256 GiB
For comparison: Original MASTERMIND   6^4 =               1 296


Simulation and Instruction of the Game (in the DOS / DOSBox-version)


HTML5 is valid! *        CSS3 is valid! *        Add to your favourites:   Strg  +  D 


Donation

I had a lot of fun with this project.
For me as an individual it also means an enormous investment of time.
I am happy if you like the game,
but I am also happy about financial recognition of my work.

If you want, you can transfer an amount of your choice to the following bank account:

GLS Gemeinschaftsbank eG
Account holder: Michael Kober
IBAN: DE89 4306 0967 7007 9199 01
BIC:   GENODEM1GLS

or send via PayPal as friend to the e-mail address michael@bulls-and-cows.de,
or even easier use this PayPal-link *.