Skip to content

Instantly share code, notes, and snippets.

@codereflection
Created February 29, 2012 00:43
Show Gist options
  • Save codereflection/1936597 to your computer and use it in GitHub Desktop.
Save codereflection/1936597 to your computer and use it in GitHub Desktop.
Gravity Kata
Gravity Kata
Create a system that shows how stacked ice blocks behave with gravity.
Here are some examples of how the ice blocks behave in this system:
Adding blocks
Before After
--->|X|
|X|
-----------------------------
Shifting blocks from left:
Before After
|X|
--->|X| |X||X|
--------------------------
Before After
|X||X||X| |X||X|
--->|X||X||X| |X||X||X||X|
-----------------------------
Before After
|X||X||X| |X||X|
--->|X||X||X| |X||X||X|
|X||X||X| |X||X||X||X|
-------------------------------
Before After
|X||X| |X||X|
--->|X||X||X| |X||X||X|
|X||X||X||X| |X||X||X||X|
-------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment