[{
  name: "Happy Numbers Kata",
  description: "<h1>Happy Numbers</h1>  <p> Wir wollen uns eine einfache Rechenvorschrift anschauen, die wir auf eine positive Zahl anwenden wollen: <ul>  <li>Die Zahl wird in ihre Ziffern zerlegt (z.B. die Zahl 4711 in 4,7,1,1)</li>  <li>Die Ziffern werden quadriert (in unserem Bsp. 16,49,1,1)</li>  <li>Die Quadrate werden summiert (also 16 + 49 + 1 + 1 = 67)</li> </ul>  Interessanterweise gibt es nur zwei mÃ¶gliche Szenarien, wenn man diese Vorschrift immer wieder auf das Resultat anwendet.  <ul>  <li>Entweder das Ergebnis wird 1</li>  <li>oder wir kommen in einen Zyklus aus folgenden 8 Zahlen: 4,16,37,58,89,145,42,20</li> </ul>Zahlen, die bei 1 enden, nennt man Happy Numbers. </p>",
  code: {
    name: "Happy",
    code: ["public class Happy {", "    ", "    public static int happyStep(int n) {", "        return -1;", "    }", "", "    public static boolean isHappy(int n) {", "        return false;", "    }", "", "    /**", "     * Zerlegt n in Ziffern. Die einzelnen Ziffern werden in einem Array", "     * gespeichert. Die Ziffern sind nicht in korrekter Reihenfolge, das spielt", "     * hier aber keine Rolle, da sowieso summiert wird.", "     * ", "     * @param Zahl,", "     *            die zerlegt werden soll", "     * @return Array der Ziffern der Eingabezahl", "     */", "    public static int[] digits(int n) {", "        int size = String.valueOf(n).length(); // Arraylaenge bestimmen", "        int[] result = new int[size];", "        for (int j = 0; j < result.length; j = j + 1, n = n / 10) {", "            result[j] = n % 10;", "        }", "        return result;", "    }", "", "}"]
  },
  test: {
    name: "HappyTest",
code: ["import static org.junit.Assert.*;",
 "import org.junit.*;",
 "",
 "public class HappyTest {",
 "",
 "    @Ignore",
 "    @Test",
 "    public void happyStep_shouldReturnOne_ifCalledWithOne() {",
 "        assertEquals(1, Happy.happyStep(1));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void happyStep_shouldReturnFour_ifCalledWithTwo() {",
 "        assertEquals(4, Happy.happyStep(2));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void happyStep_shouldReturnNine_ifCalledWithThree() {",
 "        assertEquals(9, Happy.happyStep(3));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void happyStep_shouldReturnFive_ifCalledWithTwelve() {",
 "        assertEquals(5, Happy.happyStep(12));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void happyStep_shouldReturnOne_ifCalledWithTen() {",
 "        assertEquals(1, Happy.happyStep(10));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void happyStep_shouldReturnTwentyOne_ifCalledWithFourHundredTwentyOne() {",
 "        assertEquals(21, Happy.happyStep(421));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void happyStep_shouldReturnNintyOne_ifCalledWith123456() {",
 "        assertEquals(91, Happy.happyStep(123456));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void oneIsHappy() {",
 "        assertEquals(true, Happy.isHappy(1));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void fourIsNotHappy() {",
 "        assertEquals(false, Happy.isHappy(4));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void fiveIsNotHappy() {",
 "        assertEquals(false, Happy.isHappy(5));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void sevenIsHappy() {",
 "        assertEquals(true, Happy.isHappy(7));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void nineIsHappy() {",
 "        assertEquals(false, Happy.isHappy(9));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void tenIsHappy() {",
 "        assertEquals(true, Happy.isHappy(10));",
 "    }",
 "",
 "    @Ignore",
 "    @Test",
 "    public void elevenIsHappy() {",
 "        assertEquals(false, Happy.isHappy(11));",
 "    }",
 "",
 "    @Test",
 "    public void digits_shouldReturnASingletonArray_ifCalledWithASingleDigit() {",
 "        assertArrayEquals(new int[] { 4 }, Happy.digits(4));",
 "    }",
 "",
 "    @Test",
 "    public void digits_shouldReturnAnArrayOfSizeTwo_ifCalledWithATwoDigitNumber() {",
 "        assertArrayEquals(new int[] { 2, 4 }, Happy.digits(42));",
 "    }",
 "",
 "    @Test",
 "    public void digits_shouldReturnAnArrayOfSizeFour_ifCalledWithAFourDigitNumber() {",
 "        assertArrayEquals(new int[] { 1, 1, 7, 4 }, Happy.digits(4711));",
 "    }",
 "",
 "}"]
  },
  babyStepsActivated: false,
  retrospective: false
},

{
  name: "Game of Life Kata",
  description: "<h1>Game of Life</h1>  <p>Game of life ist ein sogenannter zellul&auml;rer Automat. Wir haben ein Spielfeld, das aus Zellen besteht. Eine Zelle kann entweder tot sein oder leben. Jede Zelle hat acht Nachbarzellen. Die Randzellen werden als grunds&auml;tzlich tot definiert.</p><p>Es gibt drei Regeln, die &uuml;ber Leben und Tod entscheiden:<ol><li> Eine lebende Zelle, die weniger als zwei lebende Nachbarzellen hat, stirbt an Einsamkeit.</li><li> Eine lebende Zelle, die mehr als drei lebende Nachbarzellen hat, stirbt an &Uuml;berpopulation.</li><li> Eine tote Zelle, die genau drei lebende Nachbarzellen hat, wird lebendig.</li></ol><br>Eine vierte Regel folgt aus den anderen drei Regeln: Eine lebende Zelle mit 2 oder 3 lebenden Nachbarzellen &uuml;berlebt, eine tote Zelle mit mehr oder weniger als drei lebenden Nachbarn bleibt tot.</p><img width='50%' src='http://www3.hhu.de/stups/downloads/dojo/gol.png' />",
  code: {
    name: "GameOfLife",
    code: ["public class GameOfLife {",
"    /*",
"     * Gibt 0 zurueck, falls die Zelle in der naechsten Generation tot sein soll",
"     * Gibt 1 zurueck, falls die Zelle in der naechsten Generation lebendig sein soll",
"     */",
"    public static int spielregel(int nachbarn, int aktiv) {",
"        return -1;",
"    }",
"",
"    /*",
"     * Gibt die Anzahl der Nachbarn der Zelle an Position zeile, spalte in dem",
"     * Array board zurueck.",
"     */",
"    public static int zaehleLebendeNachbarn(int[][] board, int zeile, int spalte) {",
"        return -1;",
"    }",
"",
"",
"    /* Ausgehend von dem Array board wird ein Schritt berechnet.",
"     * Hinweis: Alle Randzellen sind immer 0",
"     */",
"    public static int[][] berechneNaechsteGeneration(int[][] board) {",
"        return board;",
"    }",
"}"]
  },
  test: {
    name: "GameOfLifeTest",
code: ["import static org.junit.Assert.*;",
"import org.junit.*;",
"",
"public class GameOfLifeTest {",
"",
"    @Ignore",
"    @Test",
"    public void einsameZellenSterbenKeineNachbarn() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(0, 1));",
"    }",

"",
"    @Ignore",
"    @Test",
"    public void toteZellenMitDreiNachbarnWerdenLebendig() throws Exception {",
"        assertEquals(1, GameOfLife.spielregel(3, 0));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void lebendeZellenMitZweiNachbarnBleibenLebendig() throws Exception {",
"        assertEquals(1, GameOfLife.spielregel(2, 1));",
"    }",
"    @Ignore",
"    @Test",
"    public void toteZellenMitZweiNachbarnBleibenTot() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(2, 0));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void toteZellenOhneNachbarnBleibenTot() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(0, 0));",
"    }",
"",
" // Folgende Tests sind zur Sicherheit, sie sollten nun alle laufen.",
" // Entfernen Sie den Blockkommentar und pruefen Sie ob alles laeuft.",
"",
"/* ",
"",
"    @Test",
"    public void einsameZellenSterbenEinNachbar() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(1, 1));",
"    }",
"",
"    @Test",
"    public void zellenMitVierNachbarnSterben() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(4, 1));",
"    }",
"",
"    @Test",
"    public void zellenMitFuenfNachbarnSterben() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(5, 1));",
"    }",
"",
"    @Test",
"    public void zellenMitSechsNachbarnSterben() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(6, 1));",
"    }",
"",
"    @Test",
"    public void zellenMitSiebenNachbarnSterben() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(7, 1));",
"    }",
"",
"    @Test",
"    public void zellenMitAchtNachbarnSterben() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(8, 1));",
"    }",
"",
"    @Test",
"    public void toteZellenMitEinemNachbarnBleibenTot() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(1, 0));",
"    }",
"",
"",
"    @Test",
"    public void lebendeZellenMitDreiNachbarnBleibenLebendig() throws Exception {",
"        assertEquals(1, GameOfLife.spielregel(3, 1));",
"    }",
"",
"    @Test",
"    public void toteZellenMitVierNachbarnBleibenTot() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(4, 0));",
"    }",
"",
"    @Test",
"    public void toteZellenMitFuenfNachbarnBleibenTot() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(5, 0));",
"    }",
"",
"    @Test",
"    public void toteZellenMitSechsNachbarnBleibenTot() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(6, 0));",
"    }",
"",
"    @Test",
"    public void toteZellenMitSiebenNachbarnBleibenTot() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(7, 0));",
"    } ",
"",
"    @Test",
"    public void toteZellenMitAchtNachbarnBleibenTot() throws Exception {",
"        assertEquals(0, GameOfLife.spielregel(8, 0));",
"    }     ",
" */",
"",
"    @Ignore",
"    @Test",
"    public void keineNachbarn() {",
"        int lebendeNachbarn = GameOfLife",
"                .zaehleLebendeNachbarn(new int[][] {",
"                    { 0, 0, 0, 0 },",
"                    { 0, 0, 0, 0 },",
"                    { 0, 0, 0, 1 }},",
"                     1,1); /* 2. Zeile, 2. Spalte */",
"        assertEquals(0, lebendeNachbarn);",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void einNachbar() {",
"        int lebendeNachbarn = GameOfLife",
"                .zaehleLebendeNachbarn(new int[][] {",
"                    { 0, 0, 0, 0 },",
"                    { 0, 0, 0, 0 },",
"                    { 0, 0, 0, 1 } }, 1, 2); /* 2. Zeile, 3. Spalte */",
"        assertEquals(1, lebendeNachbarn);",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void einNachbarUndEineEntfernteZelle() {",
"        int lebendeNachbarn = GameOfLife",
"                .zaehleLebendeNachbarn(new int[][] {",
"                    { 1, 0, 0, 0 },",
"                    { 0, 0, 0, 0 },",
"                    { 0, 0, 0, 1 } }, 1, 2); ",
"        assertEquals(1, lebendeNachbarn);",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void vierNachbarnEinerInaktivenZelle() {",
"        int lebendeNachbarn = GameOfLife",
"                .zaehleLebendeNachbarn(new int[][] {",
"                    { 1, 0, 1, 0 },",
"                    { 0, 0, 0, 1 },",
"                    { 0, 1, 0, 1 } }, 1, 2);",
"        assertEquals(4, lebendeNachbarn);",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void vierNachbarnEinerAktivenZelle() {",
"        int lebendeNachbarn = GameOfLife",
"                .zaehleLebendeNachbarn(new int[][] {",
"                    { 1, 0, 1, 0 },",
"                    { 0, 0, 1, 1 },",
"                    { 0, 1, 0, 1 } }, 1, 2);",
"        assertEquals(4, lebendeNachbarn);",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void achtNachbarnEinerAktivenZelle() {",
"        int lebendeNachbarn = GameOfLife",
"                .zaehleLebendeNachbarn(new int[][] {",
"                    { 1, 1, 1, 1 },",
"                    { 0, 1, 1, 1 },",
"                    { 0, 1, 1, 1 } }, 1, 2);",
"        assertEquals(8, lebendeNachbarn);",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void achtNachbarnEinerInaktivenZelle() {",
"        int lebendeNachbarn = GameOfLife",
"                .zaehleLebendeNachbarn(new int[][] {",
"                    { 1, 1, 1, 1 },",
"                    { 0, 1, 0, 1 },",
"                    { 0, 1, 1, 1 } }, 1, 2);",
"        assertEquals(8, lebendeNachbarn);",
"    }",
"",
"    /* Randzellen sind immer tot! */",
"",
"    @Ignore",
"    @Test",
"    public void simpleGen1() throws Exception {",
"        int[][] input = {",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 1, 0, 0, 0 },",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 0, 0, 0, 0 } };",
"        int[][] output = {",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 0, 0, 0, 0 } };",
"        checkBoard(GameOfLife.berechneNaechsteGeneration(input), output);",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void simpleGen2() throws Exception {",
"        int[][] input = {",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 1, 1, 0, 0 },",
"            { 0, 1, 1, 0, 0 },",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 0, 0, 0, 0 } };",
"        int[][] output = {",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 1, 1, 0, 0 },",
"            { 0, 1, 1, 0, 0 },",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 0, 0, 0, 0 } };",
"        checkBoard(GameOfLife.berechneNaechsteGeneration(input), output);",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void simpleGen3() throws Exception {",
"        int[][] input = {",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 0, 1, 0, 0 },",
"            { 0, 0, 0, 1, 0 },",
"            { 0, 1, 1, 1, 0 },",
"            { 0, 0, 0, 0, 0 } };",
"        int[][] output = {",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 0, 0, 0, 0 },",
"            { 0, 1, 0, 1, 0 },",
"            { 0, 0, 1, 1, 0 },",
"            { 0, 0, 0, 0, 0 } };",
"        checkBoard(GameOfLife.berechneNaechsteGeneration(input), output);",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void simpleGen4() throws Exception {",
"        int[][] input = {",
"            { 0, 0, 0, 0, 0, 0 },",
"            { 0, 0, 1, 1, 0, 0 },",
"            { 0, 0, 0, 1, 1, 0 },",
"            { 0, 1, 1, 1, 0, 0 },",
"            { 0, 0, 0, 0, 0, 0 } };",
"        int[][] output = {",
"            { 0, 0, 0, 0, 0, 0 },",
"            { 0, 0, 1, 1, 1, 0 },",
"            { 0, 1, 0, 0, 1, 0 },",
"            { 0, 0, 1, 1, 1, 0 },",
"            { 0, 0, 0, 0, 0, 0 } };",
"        checkBoard(GameOfLife.berechneNaechsteGeneration(input), output);",
"    }",
"",
"",
"    private void checkBoard(int[][] output, int[][] input) {",
"        assertEquals(input.length, output.length);",
"        for (int i = 0; i < output.length; i++) {",
"            assertArrayEquals(output[i], input[i]);",
"        }",
"    }",
"",
"}"
]
  },
  babyStepsActivated: false,
  retrospective: false
},
{
  name: "Römische Zahlen Ping Pong",
  description: "<h1>R&ouml;mische Zahlen</h1> <h2>Achtung: Heute werden wir eine Ping Pong Kata machen.</h2><ol><li>Sie schreiben einen fehlschlagenden Test.</li><li>Sie geben die Tastaur an ihre(n) Partner(in) weiter.</li><li>Ihr(e) Partner(in) schreibt nun Code, der die Tests erf&uuml;llt.</li><li>Sie &uuml;berlegen gemeinsam, ob ein Refactoring Sinn macht und Ihr(e) Partner(in) f&uuml;hrt das Refactoring aus.</li><li>Der Prozess beginnt von vorne mit vertauschten Rollen, d.h., Ihr(e) Partner(in) schreibt nun einen Test und dann wird gewechselt.</li></ol><p>Die Methode convert soll implementiert werden. Sie bekommt eine ganze Zahl zwischen 1 und 50 &uuml;bergeben und gibt die Darstellung der Zahl im r&ouml;mischen Zahlensystem aus. F&uuml;r ung&uuml;ltige Eingaben soll der leere String zur&uuml;ckgegeben werden.</p><p>Die Zahlzeichen des r&ouml;mischen Ziffersystems sind: I (1), V (5) X (10) und 50 (L). Es werden h&ouml;chstens drei gleiche Ziffern hintereinander geschreiben, dann greift die Subtraktionsregel, d.h. Es kann ein einzelnes I vor ein V oder ein  X, bzw. ein einzelnes X vor ein L geschrieben werden. Die Subraktionsregel liefert also zum Beispiel die Zahlen 4 (IV), 9 (IX), 40 (XL).</p><p>Einige weitere Beispiele: 14  = 10 + 4 (XIV), 39 = 30 + 9 (XXXIX), 44 = 40 + 4 (XLIV).</p>",
  code: {
    name: "RomanNumbers",
    code: ["public class RomanNumbers {", 
            "    ", 
            "    public String convert(int n) {", 
            "        return \"I am groot.\";",
            "    }", 
            "",  
            "}"]
  },
  test: {
    name: "RomanNumbersTest",
code: ["import static org.junit.Assert.*;",
 "import org.junit.*;",
 "",
 "public class RomanNumbersTest {",
 "",
 "",
 "    @Test",
 "    public void someTest() {",
 "        assertEquals(1, 1); // Replace me",
 "    }",
 "",
 "}"]
  },
  babyStepsActivated: false,
  retrospective: false
}

]
