# Coding Dojo

## Diamond

Python alphabet = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R","S", "T", "U", "V", "W", "X", "Y", "Z"]; input = "E" index = alphabet.index(input) arr = alphabet[1:index] + alphabet[index:0:-1] total = index*2 + 1 edge = index - 1 print(" "*index + "A" + " "*index) for i in arr: print(" " *abs(edge) + i + " " * (total - 2 * abs(edge) - 2) + i + " " * abs(edge)) edge = edge - 1 print(" " * index + "A" + " " * index) Rust This is the more accurate solution for the moment for the Diamond kata.

## FizzBuzz

This is the list of solutions to the KataFizzBuzz. Java This is a solution with the twist of supplying the filtering from the outside of the ClassUnderTest . FizzBuzzTest.java: import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; public class FizzBuzzTest { private static final Object[] ARRAY_OF_2_FIZZ = {2, "Fizz"}; private static final Object[] ARRAY_OF_1_2 = {1, 2}; private static final Object[] ARRAY_OF_FIZZ_7_8_FIZZ = {"Fizz", 7, 8, "Fizz"}; private static final Object[] ARRAY_OF_BUZZ = {"Buzz"}; private static final Object[] ARRAY_OF_FIZZBUZZ = {"FizzBuzz"}; private static final Object[] ARRAY_OF_FIZZBUZZ_TO_FIZZ = { "FizzBuzz", 16, 17, "Fizz", 19, "Buzz", "Fizz", 22, 23, "Fizz", "Buzz", 26, "Fizz", 28, 29, "FizzBuzz"}; FizzBuzz fizzBuzz = new FizzBuzz(); @Before public void addFilters() { fizzBuzz.

## FizzBuzz Java

/* @ProjectName:mianshi @Package:PACKAGE_NAME @ClassName:MianShi @Author:Rain @Date:2022-01-05 10:17 @Description: */ public class MianShi { public static void main(String[] args) { m1(); System.out.println("********************"); m2(); } public static void m1() { for (int i = 1; i <= 100; i++) { if (i % 3 == 0 && i % 5 == 0) { System.out.println(“FizzBuzz”); } else if (i % 3 == 0) { System.out.println(“Fizz”); } else if (i % 5 == 0) { System.

## Kata Roman Numerals

Feel free to create a merge request on the codingdojo repository to suggest your own solution. Python This is the most readable solution of the Roman Numerals Kata downloaded on this website. #!/usr/bin/env python def number_to_numeral(number): """ >>> number_to_numeral(1) 'I' >>> number_to_numeral(2) 'II' >>> number_to_numeral(12) 'XII' >>> number_to_numeral(10) 'X' >>> number_to_numeral(20) 'XX' >>> number_to_numeral(99) 'XCIX' >>> number_to_numeral(100) 'C' >>> number_to_numeral(199) 'CXCIX' >>> number_to_numeral(2399) 'MMCCCXCIX' >>> number_to_numeral(4000) Traceback (most recent call last): .

## KataBankInGroovyByNiravAssar

This was a solution I did in groovy. I have posted the entire package on google docs. The notable points to the solution are as follows: done in groovy done with object oriented principles and design uses recursion contains some high level documentation https://docs.google.com/leaf?id=0B62m4BA4zKvjMTdlZTNkNDktN2IyMS00YjcxLWJkN2ItZDc5MjNhMjYwOWE4&sort=name&layout=list&num=50 You can contact me with questions at

In CodersDojoSweden we have done the KataBowling quite a lot of times. Our test suite usually ends up like: Gutter game = all zeroes, (score = 0) One pin down in each roll, (score = 20) Spare in first roll, one pin down in each other roll, (score = 10 + 1 + 18 = 29) Spare in last roll, one pin down in each other roll, (score = 18 + 10 + 1 = 29) Strike in first roll, one pin down in each other roll, (score = 10 + 1 + 1 + 18 = 30) Strike in last roll, one pin down in each other roll, (score = 18 + 10 + 1 + 1 = 30) Golden game = all strikes (score = 300) The highligts of the BowlingGameKata is:

## KataFizzBuzzSmalltalkSolution

fb := [:counter| |rules| rules := {15->'FizzBuzz'. 5->'Buzz'. 3->'Fizz'. 1->counter}. rightRule := rules detect: [:aRule| counter \\ aRule key == 0]. rightRule value]. self assert: (fb value: 7) == 7. self assert: (fb value: 3) == 'Fizz'. self assert: (fb value: 5) == 'Buzz'. self assert: (fb value: 15) == 'FizzBuzz'. 1 to: 100 do: [:counter | Transcript show: (fb value: counter) asString; cr]

## KataFizzBuzzSolution

This my solution to the [KataFizzBuzz](/kata/FizzBuzz) , with the added twist of supplying the filtering from the outside of the ClassUnderTest . FizzBuzzTest.java: import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; public class FizzBuzzTest { private static final Object[] ARRAY_OF_2_FIZZ = {2, "Fizz"}; private static final Object[] ARRAY_OF_1_2 = {1, 2}; private static final Object[] ARRAY_OF_FIZZ_7_8_FIZZ = {"Fizz", 7, 8, "Fizz"}; private static final Object[] ARRAY_OF_BUZZ = {"Buzz"}; private static final Object[] ARRAY_OF_FIZZBUZZ = {"FizzBuzz"}; private static final Object[] ARRAY_OF_FIZZBUZZ_TO_FIZZ = { "FizzBuzz", 16, 17, "Fizz", 19, "Buzz", "Fizz", 22, 23, "Fizz", "Buzz", 26, "Fizz", 28, 29, "FizzBuzz"}; FizzBuzz fizzBuzz = new FizzBuzz(); @Before public void addFilters() { fizzBuzz.