Skip to content

Instantly share code, notes, and snippets.

@aslakhellesoy
Forked from dchelimsky/gist:52595
Created January 26, 2009 00:15
Show Gist options
  • Save aslakhellesoy/52628 to your computer and use it in GitHub Desktop.
Save aslakhellesoy/52628 to your computer and use it in GitHub Desktop.
Feature: submit guess
The code-breaker submits a guess of four colored
pegs. The mastermind game marks the guess with black
and white "marker" pegs.
For each peg in the guess that matches color
and position of a peg in the secret code, the
mark includes one black peg. For each additional
peg in the guess that matches the color but not
the position of a color in the guess, a white
peg is added to the mark.
Scenario Outline: submit guess
Given the secret code is <code>
When I guess <guess>
Then the mark should be <mark>
Examples: all colors correct
| code | guess | mark |
| r g y c | r g y c | bbbb |
| r g y c | r g c y | bbww |
| r g y c | y r g c | bwww |
| r g y c | c r g y | wwww |
Examples: 3 colors correct
| code | guess | mark |
| r g y c | w g y c | bbb |
| r g y c | w r y c | bbw |
| r g y c | w r g c | bww |
| r g y c | w r g y | www |
Examples: 2 colors correct
| code | guess | mark |
| r g y c | w g w c | bb |
| r g y c | w g w c | bw |
| r g y c | g w c w | ww |
Examples: 1 color correct
| code | guess | mark |
| r g y c | r w w w | b |
| r g y c | w w r w | w |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment