/ansible-playbook-mastermind

Play the game of Mastermind in Ansible

ISC LicenseISC

Ansible Playbook: Mastermind

This project is attempt to bring the board game of of Mastermind (although a bit mixed with Bulls and Cows) to Ansible.

The goal is to find a secret combination of four coloured pegs in a given number of turns (here twelve) by submitting guesses and analysing the answers. The game will display the result as a number of “bulls” (number of correctly guessed colours and positions) or “cows” (number of correctly guessed colours but incorrect positions).

At the end of each turn a summary of past guesses is displayed like this:

TASK [debug] *******************************************************************
ok: [localhost] =>
  msg: |-
    Turn 1: |  red   |  red   |  red   |  red   |
    Turn 2: |  red   |  blue  |  blue  |  blue  |
    Turn 3: |  red   |  blue  |  blue  | black  |
    Turn 4: |  red   |  blue  | black  |  blue  |
    ----
    4 bulls and 0 cows

How to play

The following packages are necessary:

  • ansible

Simply run the following command:

$ ansible-playbook mastermind.yml
...

Here is an asciicast recording:

asciicast

License

ISC

Contributing

Either send send GitHub pull requests or send patches on SourceHut.

Author Information

Tristan Le Guern tleguern@bouledef.eu