To the old JavaScript (ES5)

www.Bulls-and-Cows.de
    vs.    
MASTERMIND
Superhirn

  www.Bulls-and-Cows.de
MASTERMIND - Original vs. MASTERMIND - Superhirn - Michael Kober
Knack den Code!
Crack the code!
The Game
comercial   free of charge


adjust font-size:
(current font-size  1 ):
 1   1.25   1.5   1.75   2 


Kasperledeutsch: "Gendern" und "gendergerechte Sprache" (German only)

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.

Recommendations per operating system

Comparison of different operating systems

Simulation of the DOSBox-version

Bulls and Cows or Cows and Bulls is a free and already old 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
   (complex control)

 *

  • 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.
  • 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 1900+ 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 5 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
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 0:
full-screen-mode without side-control-bar without on-screen-keyboard,
Settings for using a physical keyboard !
Landscape browser-game 0: full-screen-mode without side-control-bar without on-screen-keyboard,
Settings for using a physical keyboard !


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




Installing the DOSBox-program
(especially on Windows)
and the DOS-versions of Bulls and Cows


  • DOS versions run on 32-bit-Windows with and without the DOSBox-program.
  • advantages in the display (window size, graphic-characters, line-breaks)
  • offers additional options through the DOSBox-program itself
  • language packs for DOS
  • 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
    • Windows: D-Fend Reloaded *
    • Apple Mac OS X / OS X / macOS:
      boxer 1.4 *, boxer 2.0 * from macOS Catalina 10.15, Dapplegrey *


  • Installation:

    Android:
    Important!
    On Android only one instance of a program can be used at a time.
    i.e. DOSBox can only be started once.
    The best alternative to an installation is the browser-game.

    To install you will need:
    All installed it looks like this on my smartphone (Huawei P30 Pro) in landscape-mode:

    Android Magic DOSBox landscape-mode

    and in portrait-mode like this:

    Android Magic DOSBox portrait-mode


    All other operating systems:
    Please download one of the following archives and unzip it:
    BC.zip ---- BCunzip.exe (Windows, self-extracting) ---- BC.7z ---- BC.tar (Linux, Unix)

    If this causes difficulties, the individual files can be downloaded here:
    BC.EXE ---- BCR.EXE ---- README.EXE ---- RTM.EXE ---- DPMI16BI.OVL

    Also install DOSBox * or DOSBox for macOS-64-bit * from macOS Catalina 10.15.
    In Linux and FreeBSD, the DOSBox-program is usually included in the respective distributions
    and only needs to be installed via the package-manager.

    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=dynamic, cputype=auto, cycles=max, 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 every 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 alternative is 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.
DOSBox offers more options and is more user-friendly.
On a 32-bit-Windows-system the DOS-versions of Bulls and Cows
also run without DOSBox.

Please click warnings from the operating system away with 'Allow'
or '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,
or 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) or 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 or 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 on Windows)


using VirtualBox * (64-bit) / VirtualBox 32-bit (old version) * for 32-bit-systems
(or the VMware Workstation Player *, only 64-bit) as virtualization-software..

Background:
  • The Linux-version of Bulls and Cows is much faster than the Windows-version
    and therefore offers the most game variants.
  • 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.

A further increase in the main memory does not lead to any more game variants,
since now the limit of the number space used (LongInt) is the limiting factor.


Or you can try out several of the options mentioned -
beside the browser-game on all systems:

Installation-options per operating systems:
Used
OS:
DOS &
Win 3.11
Windows
32 bit
Windows
64 bit
Android
32/64 bit
Best: BC.EXE DOSBox + BC.EXE
D-Fend Reloaded
browser-game
Executable
versions of
Bulls & Cows:
DOS
(BC.EXE&
BCR.EXE)
DOS
(BC.EXE&
BCR.EXE)

Win 32 Bit




32/64 bit

each !only with
root-rights! :

32/64 bit
DOSBox: --- download various;
recommended:
Magic DOSBox
DOSBox-
frontend:
--- D-Fend Reloaded
DOS.Zone-
Browser
--- --- yes only 64 bit
VirtualBox: --- Ver. 5.2.x yes ---
VMware Player: --- --- yes ---

Installation-options per operating systems:
Used
OS:
macOS Linux
32/64 bit
FreeBSD
32/64 bit
Solaris
32/64 bit
OS/2
RiscOS
Best: 32/64 bit
from 10.15
only 64 bit

32/64 bit

32/64 bit

32 bit
DOSBox+
BC.EXE
Executable
versions:
---
DOSBox: download package-
management
over ports --- download
DOS.Zone-
Browser
yes only 64 bit --- --- ---
VirtualBox: yes yes --- yes ---
VMware Player: --- only 64 bit --- --- ---


Comparison of 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.
Code-length: 2 3 4 5 6 7 8 9 Maximum RAM:
DOS Real Mode 36 23 11 7 5 4 3 3 3^9 =  19 683 640  KiB
HTML5 / DPMI 36 36 33 17 11 8 6 5 8^7 =  2 097 152 64  MiB
32 bit 36 36 36 31 18 13 9 7 13^7 =  62 748 517 GiB
64 bit 36 36 36 29 16 11 8 6 29^5 =  20 511 149 GiB
36 36 36 33 18 12 9 7 9^8 =  43 046 721 GiB
36 36 36 35 21 13 9 7 21^6 =  85 766 121 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
MASTERMIND 6^4 =  1 296 640  KiB


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


All yellow keys (except Esc/Escape) are also keyboard-operable when focused.
Alle gelben Tasten (außer Esc/Escape) sind auch über Ihre Tastatur bedienbar, wenn fokusiert.


HTML5 is valid! *       CSS3 is valid! *       Add to your favourites:    Ctrl  +  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.

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

QR-code:
Bank-details
for a donation


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


Donate with "Buy Me A Coffee":
Various payment-options *