의도적 인 연습 운동.
이 운동은 소프트웨어 개발 기술을 연습하고 새로운 기술 학습, 새로운 작업 방법 찾기 등을 사용하는 데 사용될 수 있습니다.
전통적으로 게임은 다음을 사용하여 재생됩니다.
한쪽 끝에 4 개의 큰 구멍 행을 덮고있는 방패가있는 디코딩 보드 , 4 개의 작은 구멍 세트 옆에 4 개의 큰 구멍이 들어있는 12 개의 추가 행
6 가지 색상의 코드 페그 , 보드의 큰 구멍에 배치됩니다.
작은 키 페그 , 일부 색상의 검은 색, 흰색, 보드의 작은 구멍에 배치됩니다.
출처 : Wikipedia
기존의 마스터 마인드 게임에는 두 명의 선수가 있습니다.
Codemaker- 4 개의 코드 페그 패턴을 선택하여 방패로 덮인 4 개의 구멍에 배치합니다. 이 비밀 코드는 코드 메이커에게만 볼 수 있습니다.
CodeBreaker- 순서와 색상 모두에서 12 번의 회전을 포함한 비밀 코드를 추측하려고합니다. 각 추측은 디코딩 보드에 한 줄의 코드 페그를 배치하여 이루어집니다. 일단 배치되면 코드 메이커는 추측과 함께 행의 작은 구멍에 0에서 4 개의 키 페그를 배치하여 피드백을 제공합니다.
피드백은 주요 페그와 함께 제공됩니다.
색상과 위치 모두에서 올바른 추측에서 각 코드 페그에 대해 검은 색 키 페그가 배치됩니다.
흰색 키 페그는 각 코드 페그마다 배치됩니다. 추측은 색상이지만 잘못된 위치입니다.
추측에 중복 색상이있는 경우 비밀 코드에서 동일한 수의 중복 색상에 해당하는 경우 키 페그 만 수여 할 수 있습니다.
검은 색 키 페그는 흰색 키 페그 앞에 배치됩니다
사람들은 스토리 텔러입니다. 따라서 사례를 사용하여 비즈니스 규칙에 대해 이야기하고 문서화하는 것은 공유 된 이해를 신속하게 구축하는 매우 강력한 기술입니다.
우리는 구조를 좋아하기 때문에 Gherkin을 사용하기로 결정했지만 모든 형식은 똑같이 잘 작동합니다.
메모 | Gherkin은 간단한 구조를 가진 일반 텍스트 언어입니다. Gherkin 시나리오에 표시된 예는 비즈니스 규칙을 설명하기위한 것입니다. Gherkin은 비 프로그래머에서 사용할 수 있지만 비즈니스 규칙 및 자동화에 대한 간결한 설명을 허용 할만 큼 구성되어 있습니다. |
Feature : Playing mastermind
As a code breaker
I want to practice breaking codes
In order to have fun
Scenario : Joining the game
Given a decoding board of 12 attempts
And the code maker has placed a secret on the board
When I join the game
Then the game should be started with an empty board
And I should have 12 attempts available
Scenario Outline : Making a guess
Given a decoding board of 12 attempts
And the code maker placed the "<Pattern>" code pattern on the board
When I try to break the code with "<Guess>"
Then the code maker should give me "<Feedback>" feedback on my guess
Examples :
# Feedback legend:
# B - Black - Correct colour and position
# W - White - Correct colour but wrong position
| Pattern | Guess | Feedback |
| Red Green Blue Yellow | Red Purple Purple Purple | B |
| Red Green Blue Yellow | Purple Purple Purple Purple | |
| Red Green Blue Yellow | Purple Red Purple Purple | W |
| Red Green Blue Yellow | Red Purple Green Purple | B W |
| Red Green Blue Yellow | Red Green Blue Purple | B B B |
| Red Green Blue Yellow | Red Yellow Blue Green | B B W W |
| Red Green Blue Yellow | Yellow Blue Green Red | W W W W |
| Red Green Blue Yellow | Red Green Blue Yellow | B B B B |
| Red Green Blue Yellow | Red Red Red Purple | B |
| Green Red Blue Yellow | Green Yellow Red Blue | B W W W |
| Green Red Blue Yellow | Red Green Yellow Blue | W W W W |
| Green Red Blue Yellow | Green Red Yellow Blue | B B W W |
| Red Green Red Yellow | Red Red Purple Purple | B W |
| Red Red Red Yellow | Red Green Purple Purple | B |
| Red Red Blue Yellow | Purple Purple Red Purple | W |
| Red Blue Blue Yellow | Purple Purple Red Red | W |
Scenario : Winning a game
Given a decoding board of 12 attempts
And the code maker placed the "Red Green Blue Yellow" secret on the board
When I try to break the code with an invalid pattern 11 times
But I break the code in the final guess
Then I should win the game
And I should no longer be able to make guesses
Scenario : Losing a game
Given a decoding board of 12 attempts
And the code maker placed the "Red Green Blue Yellow" secret on the board
When I try to break the code with an invalid pattern 12 times
Then I should lose the game
And I should no longer be able to make guesses