Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add diamond kata exercise #191

Merged
merged 1 commit into from
Mar 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions diamond.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## Diamond kata

The diamond kata takes as its input a letter, and outputs it in a diamond
shape. Given a letter, it prints a diamond starting with 'A', with the
supplied letter at the widest point.

## Requirements

* The first row contains one 'A'.
* The last row contains one 'A'.
* All rows, except the first and last, have exactly two identical letters.
* The diamond is horizontally symmetric.
* The diamond is vertically symmetric.
* The diamond has a square shape (width equals height).
* The letters form a diamond shape.
* The top half has the letters in ascending order.
* The bottom half has the letters in descending order.
* The four corners (containing the spaces) are triangles.

## Examples

Diamond for letter 'A':

```plain
A
```

Diamond for letter 'C':

```plain
A
B B
C C
B B
A
```

Diamond for letter 'E':

```plain
A
B B
C C
D D
E E
D D
C C
B B
A
```
4 changes: 4 additions & 0 deletions diamond.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
blurb: "Given a letter, print a diamond starting with 'A' with the supplied letter at the widest point."
source: "Seb Rose"
source_url: "http://claysnow.co.uk/recycling-tests-in-tdd/"