Sunday, February 1, 2015

Kata: LCD Digits in Clojure

I've just done the LCD Digits kata in Clojure.

In this kata you have to create an LCD string representation of an integer value using a 3x3 grid of space, underscore, and pipe characters for each digit.

Each digit is shown below (using a dot instead of a space)
._.   ...   ._.   ._.   ...   ._.   ._.   ._.   ._.   ._.
|.|   ..|   ._|   ._|   |_|   |_.   |_.   ..|   |_|   |_|
|_|   ..|   |_.   ._|   ..|   ._|   |_|   ..|   |_|   ..|


Example: 910

._. ... ._.
|_| ..| |.|
..| ..| |_|
These are the tests using Midje:

and this is the resulting code:

I used a mix of TDD and REPL-driven development to code it.

To document the process I commited the code after every passing test and every refactoring and also commited the REPL history.

You can find the commits step by step here and the code in this repository in GitHub.

No comments:

Post a Comment