# Coding Dojo

## 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 , 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.