Coding Dojo

Edit on Github


About this Kata Alistair Cockburn wrote a blog post about this kata, in response to the Seb Rose kata proposition. Problem Description Given a letter, print a diamond starting with ‘A’ with the supplied letter at the widest point. For example: print-diamond ‘C’ prints A B B C C B B A


About this Kata This Kata was posted as the problem to be solved in a “self-documenting code contest”: Problem Description Write a program that generates all two-word anagrams of the string “documenting”. Here’s a word list you might want to use: Clues You should think about the performance of your solution and whether making it faster affects readability. Suggested Test Cases none as yet. Comments from those who are working on this Kata


About this Kata This Kata is presented in Robert C.. Martin’s book “Clean Code”, chapter 14. Problem Description Most of us have had to parse command-line arguments from time to time. If we don’t have a convenient utility, then we simply walk the array of strings that is passed into the main function. There are several good utilities available from various sources, but they probably don’t do exactly what we want.


This Kata was presented at XP2006 by EmmanuelGaillot and ChristopheThibaut . Problem Description User Story 1 You work for a bank, which has recently purchased an ingenious machine to assist in reading letters and faxes sent in by branch offices. The machine scans the paper documents, and produces a file with a number of entries which each look like this: _ _ _ _ _ _ _ | _| _||_||_ |_ ||_||_| ||_ _| | _||_| ||_| _| Each entry is 4 lines long, and each line has 27 characters.


This description is based on that at Adventures in C#: The Bowling Game Problem Description Create a program, which, given a valid sequence of rolls for one line of American Ten-Pin Bowling, produces the total score for the game. Here are some things that the program will not do: We will not check for valid rolls. We will not check for correct number of rolls and frames. We will not provide scores for intermediate frames.


About this Kata Difficulty: easy Good for teaching: recursion Related Katas: KataBreadthFirstSearch Problem Description Depth-first search is not just an AI technique it is also the standard way that trees (ubiquitous in computer science) are traversed. Clues For this (easiest) form of depth-first search, steer towards using the function-call stack, rather than a stack data structure. Try to avoid implementing a Graph or Maze or Problem class (even as a mocked interface) for your depth-first-searcher to traverse.


This kata is about making a simple string replacer. It is inspired by Corey Haines Lightning talk about practicing. ( Create a method that takes a string and a dictionary, and replaces every key in the dictionary pre and suffixed with a dollar sign, with the corresponding value from the Dictionary. Tests input : “”, dict empty, output:“” input : “\$temp\$“, dict [“temp”, “temporary”], output: “temporary” input : “\$temp\$ here comes the name \$name\$“, dict [“temp”, “temporary”] [“name”, “John Doe”], output : “temporary here comes the name John Doe”


About this Kata This Kata was posted here by someone anonymously. Michael Feathers and EmilyBache performed it at agile2008 when competing in “Programming with the stars” in python, in 4 minutes. Difficulty: Easy Good for teaching: TDD , BabySteps Problem Description Imagine the scene. You are eleven years old, and in the five minutes before the end of the lesson, your Maths teacher decides he should make his class more “fun” by introducing a “game”.


About this Kata This was presented as a PreparedKata at XP2005, by Emmanuel Gaillot. Difficulty - medium Similar Katas - KataMinesweeper , KataReversi Problem Description This Kata is about calculating the next generation of Conway’s game of life, given any starting position. See for background. You start with a two dimensional grid of cells, where each cell is either alive or dead. In this version of the problem, the grid is finite, and no life can exist off the edges.

KataGreed Greed (Dice Game) Write a class Greed with a score() method that accepts an array of die values (up to 6). Scoring rules are as follows: A single one (100) A single five (50) Triple ones [1,1,1] (1000) Triple twos [2,2,2] (200) Triple threes [3,3,3] (300) Triple fours [4,4,4] (400) Triple fives [5,5,5] (500) Triple sixes [6,6,6] (600) Note that the scorer should work for any number of dice up to 6.


About this Kata This is the famous “ [Hello World] “ program. Hello World is perhaps the first Kata – it predates even the term “kata”. But people have been doing Hello World as effectively a kata for over thirty years. The seminal book [The C Programming Language] has created the tradition of making it the first program in any new language, environment, or methodology. So it follows that the first kata should be Hello World.


Background In this Kata, your a programmer at ABC Corp and you’re making a new web app from scratch. After the head architect started working on this, it’s now up to you to make sure these tasks are completed: allow authentication using request parameters (GET or POST) all authentication/login attempts should be verified agains LDAP successful logins should be recorded in the single sign on registry However, you’re not the only programmer (team) adressing this web app, so the LDAP is written by another team and what you have right now is this interface:


About this Kata Kata originated here: Difficulty: Easy Problem Description Have you ever played Minesweeper? It’s a cute little game which comes within a certain Operating System whose name we can’t really remember. Well, the goal of the game is to find all the mines within an MxN field. To help you, the game shows a number in a square which tells you how many mines there are adjacent to that square.


I saw a screen cast that Corey Haines did on this at The code for his solution is at The basic idea is the inverse of KataBankOCR SteveDonie


Problem Description It occurs now and then in real life that people want to write about money, especially about a certain amount of money. If it comes to cheques or contracts for example some nations have laws that state that you should write out the amount in words additionally to the amount in numbers to avoid fraud and mistakes. So if you want to transfer 745 \$ to someone via cheque you have to fill out to fields:


DeleteMe (Contents moved to KataNumbersInWords )


About this Kata Difficulty: easy Good for teaching: does doing a SDUF (Small Design Up Front) taking monsters into account make a big difference in design and (initial and/or ongoing) velocity? Related Katas: GameOfLife - the board design was taken from there. We simulate a game you play continuously with turns. First performed January 6 during a event at Kicked off by Marc Evers and Rob Westgeest, initial steps brainstormed and facilitated by Willem van den Ende, programmed by a majority of the participants :)


About this Kata This kata is blatantly stolen from It is a subset of KataTexasHoldEm , which is a very large Kata. Problem Description Your job is to compare several pairs of poker hands and to indicate which, if either, has a higher rank. Poker rules description A poker deck contains 52 cards - each card has a suit which is one of clubs, diamonds, hearts, or spades (denoted C, D, H, and S in the input data).


If you want to try this Kata for yourself or at your dojo meeting, read the problem description and see if the Kata appeals to you. The rest is commentary and helpful clues for if you get stuck solving it. I would recommend trying the Kata for yourself before reading too much of it. Problem Description Once upon a time there was a series of 5 books about a very English hero called Harry.


Quote of the day CGI About this Kata I teach web applications programming to undergraduates. I usually explain the stuff, point them to the book, and ask them to produce a finished web application as part of their examination. On some people it works and they make great apps. On other people it doesn’t. This year I’m trying a new approach, to teach with katas. I started with this small kata.


Range has a lot of nifty issues. integer range contains [2,6) contains {2,4} [2,6) doesn’t contain {-1,1,6,10} getAllPoints [2,6) allPoints = {2,3,4,5} ContainsRange [2,5) doesn’t contain [7,10) [2,5) doesn’t contain [3,10) [3,5) doesn’t contain [2,10) [2,10) contains [3,5] [3,5] contains [3,5) endPoints [2,6) allPoints = {2,3,4,5} [2,6] allPoints = {2,3,4,5,6} (2,6) allPoints = {3,4,5} (2,6] allPoints = {3,4,5,6} overlapsRange [2,5) doesn’t overlap with [7,10)


About this Kata This Kata was introduced to me by LaurentBossavit – EmilyBache Difficulty: Medium Problem Description Reversi is a board game for two players. More information can be found on Wikipedia . This Kata is to write a program that takes a current board position together with information about whose turn it is, and returns a list of the legal moves for that player. A move is only legal if it results in at least one of the opponent’s counters being flipped.


About this Kata CodersDojoSweden , running in Linköping, was looking for a new Kata which was sufficiently simple to get beginners up and running. ThomasNilsson suggested a calculator using Roman numerals. Problem Description “As a Roman Bookkeeper I want to add Roman numbers because doing it manually is too tedious.” Given the Roman numerals, (IVXLCDM which means one, five, ten, fifty, hundred, fivehundred and a thousand respectively), create two numbers and add them.


About this Kata This Kata is about implementing a simple tennis game. I came up with it while thinking about Wii tennis, where they have simplified tennis, so each set is one game. The scoring system is rather simple: 1. Each player can have either of these points in one game 0 15 30 40 2. If you have 40 and you win the ball you win the game, however there are special rules.


by Matthew D Moss, blatantly stolen from If you want to try this Kata for yourself or at your dojo meeting, read the problem description and see if the Kata appeals to you. The rest is commentary and helpful clues for if you get stuck solving it. I would recommend trying the Kata for yourself before reading too much of it. For an easier kata, try KataPokerHands first. Difficulty: hard


About this Kata In this Kata you will be implementing a rudimentary two-player trading card game. The rules are loosely based on Blizzard Hearthstone ( ) which itself is an already much simpler and straight-forward game compared to other TCGs like Magic: The Gathering ( ). Difficulty: Medium/Hard Good for teaching: Test Doubles, Mocking, TDD, Refactoring, Clean Code Problem Description 1. Preparation Each player starts the game with 30 Health and 0 Mana slots Each player starts with a deck of 20 Damage cards with the following Mana costs: 0,0,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,7,8 From the deck each player receives 3 random cards has his initial hand 2.


This kata is from Robert Martin and his blog includes a solution in Java [1] . Problem Description You write a class called Wrapper, that has a single static function named wrap that takes two arguments, a string, and a column number. The function returns the string, but with line breaks inserted at just the right places to make sure that no line is longer than the column number. You try to break lines at word boundaries.


About this Kata This problem is based on Ruby Quiz #19 ( ). The kata takes about 20 minutes with practice and 2 hours in a dojo setting. Problem Description The game of yahtzee is a simple dice game. Each round, each player rolls five six sided dice. The player may choose to reroll some or all of the dice up to three times (including the original roll). The player then places the roll at a category, such as ones, twos, sixes, pair, two pairs etc.


About this Kata Basic informations about Nim Game : Difficulty: Easy Problem Description Build a Nim Game where you can play with two players. Start with 10 sticks, then you can add some game setup difficulty with variable started stick and players name, you can build an beautiful GUI too or just play in terminal.

Roman Numerals

About this Kata I wasn’t there, but I believe this Kata was performed at XP2001 by Kent Beck. Here is [a video of Karl Scotland doing this Kata in Excel at agile 2008] Here is [a video of JonJagger doing this Kata in Ruby using CyberDojo] Difficulty - Easy. Problem Description The Romans were a clever bunch. They conquered most of Europe and ruled it for hundreds of years. They invented concrete and straight roads and even bikinis [1].