{"id":15525570,"url":"https://github.com/jakzal/mastermind","last_synced_at":"2026-01-08T04:15:10.378Z","repository":{"id":187232746,"uuid":"676485476","full_name":"jakzal/mastermind","owner":"jakzal","description":"A deliberate practice exercise","archived":false,"fork":false,"pushed_at":"2023-11-01T22:24:08.000Z","size":859,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-03T06:38:49.898Z","etag":null,"topics":["code-kata","deliberate-practice","kata","practice"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jakzal.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-09T09:59:35.000Z","updated_at":"2024-08-27T08:30:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"faa6f89e-0a7d-4204-bf97-be542f37d171","html_url":"https://github.com/jakzal/mastermind","commit_stats":null,"previous_names":["jakzal/mastermind"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakzal%2Fmastermind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakzal%2Fmastermind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakzal%2Fmastermind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakzal%2Fmastermind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakzal","download_url":"https://codeload.github.com/jakzal/mastermind/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246100494,"owners_count":20723469,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-kata","deliberate-practice","kata","practice"],"created_at":"2024-10-02T10:58:41.858Z","updated_at":"2026-01-08T04:15:10.334Z","avatar_url":"https://github.com/jakzal.png","language":null,"readme":":data-uri:\n:source-highlighter: rouge\n\n= Mastermind\n\nA https://en.wikipedia.org/wiki/Practice_(learning_method)#Deliberate_practice[deliberate practice] exercise.\n\nThe exercise can be used to practice software development techniques, learning new technologies,\nfinding new ways of working, etc.\n\n== Rules\n\nTraditionally, the game is played using:\n\n* **a decoding board**, with a shield at one end covering a row of four large holes, and twelve additional rows containing\n  four large holes next to a set of four small holes\n\n* **code pegs** of six different colours, which will be placed in the large holes on the board\n\n* small **key pegs**, some coloured black, some white, which will be placed in the small holes on the board\n\nsource: https://en.wikipedia.org/wiki/Mastermind_(board_game)[Wikipedia]\n\n.Mastermind game board\nimage::mastermind-board.svg[Mastermind game board,200,opts=inline]\n\n// image source: https://excalidraw.com/#json=4QuOptjhjfQUUurx4zZo3,9MYvKGFTgj00QtmFoo3H7Q\n\nIn the conventional Mastermind game there are two players:\n\n* **CodeMaker** - chooses a pattern of four code pegs and places them in the four holes covered by the shield.\n  This secret code is only visible to the CodeMaker.\n\n* **CodeBreaker** - tries to guess the secret code withing twelve turns, in both order and colour.\n  Each guess is made by placing a row of code pegs on the decoding board. Once placed,\n  the CodeMaker provides feedback by placing zero to four key pegs in the small holes of the row with the guess.\n\nFeedback is provided with key pegs:\n\n* a **black key peg** is placed for each code peg from the guess which is correct in both colour and position\n\n* a **white key peg** is placed for each code peg from the guess which is correct in colour but in a wrong position\n\n* if there are duplicate colours in the guess, they can only be awarded a key peg if they correspond to the same number of duplicate colours in the secret code\n\n* **black key pegs** are placed before **white key pegs**\n\n== Acceptance criteria\n\nPeople are storytellers. Therefore, using examples to talk about business rules and document them\nis a very powerful technique to build a shared understanding quickly.\n\nWe chose to use Gherkin since we like its structure, but any format would work equally well.\n\n[NOTE]\n====\nGherkin is a plain-text language with a simple structure.\nExamples shown in Gherkin scenarios are meant to illustrate the business rules.\n\nGherkin can be used by non-programmers while it is structured enough to allow concise description of business rules\nand their automation.\n====\n\n[source,gherkin]\n----\nFeature: Playing mastermind\nAs a code breaker\nI want to practice breaking codes\nIn order to have fun\n\n  Scenario: Joining the game\n    Given a decoding board of 12 attempts\n    And the code maker has placed a secret on the board\n    When I join the game\n    Then the game should be started with an empty board\n    And I should have 12 attempts available\n\n  Scenario Outline: Making a guess\n    Given a decoding board of 12 attempts\n    And the code maker placed the \"\u003cPattern\u003e\" code pattern on the board\n    When I try to break the code with \"\u003cGuess\u003e\"\n    Then the code maker should give me \"\u003cFeedback\u003e\" feedback on my guess\n    Examples:\n      # Feedback legend:\n      # B - Black - Correct colour and position\n      # W - White - Correct colour but wrong position\n      | Pattern               | Guess                       | Feedback |\n      | Red Green Blue Yellow | Red Purple Purple Purple    | B        |\n      | Red Green Blue Yellow | Purple Purple Purple Purple |          |\n      | Red Green Blue Yellow | Purple Red Purple Purple    | W        |\n      | Red Green Blue Yellow | Red Purple Green Purple     | B W      |\n      | Red Green Blue Yellow | Red Green Blue Purple       | B B B    |\n      | Red Green Blue Yellow | Red Yellow Blue Green       | B B W W  |\n      | Red Green Blue Yellow | Yellow Blue Green Red       | W W W W  |\n      | Red Green Blue Yellow | Red Green Blue Yellow       | B B B B  |\n      | Red Green Blue Yellow | Red Red Red Purple          | B        |\n      | Green Red Blue Yellow | Green Yellow Red Blue       | B W W W  |\n      | Green Red Blue Yellow | Red Green Yellow Blue       | W W W W  |\n      | Green Red Blue Yellow | Green Red Yellow Blue       | B B W W  |\n      | Red Green Red Yellow  | Red Red Purple Purple       | B W      |\n      | Red Red Red Yellow    | Red Green Purple Purple     | B        |\n      | Red Red Blue Yellow   | Purple Purple Red Purple    | W        |\n      | Red Blue Blue Yellow  | Purple Purple Red Red       | W        |\n\n  Scenario: Winning a game\n    Given a decoding board of 12 attempts\n    And the code maker placed the \"Red Green Blue Yellow\" secret on the board\n    When I try to break the code with an invalid pattern 11 times\n    But I break the code in the final guess\n    Then I should win the game\n    And I should no longer be able to make guesses\n\n  Scenario: Losing a game\n    Given a decoding board of 12 attempts\n    And the code maker placed the \"Red Green Blue Yellow\" secret on the board\n    When I try to break the code with an invalid pattern 12 times\n    Then I should lose the game\n    And I should no longer be able to make guesses\n----\n\n== Event model\n\n.Mastermind event model\nimage::mastermind-event-model.svg[Mastermind event model]\n\n// image source: https://excalidraw.com/#json=lEF7VZ-SRShlpzeXgr_cR,wenYsJlj4WtBHNPYfc80hg\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakzal%2Fmastermind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakzal%2Fmastermind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakzal%2Fmastermind/lists"}