Created
August 9, 2013 09:41
-
-
Save tobyweston/6192446 to your computer and use it in GitHub Desktop.
Work out the size of a grid required to display n tiles whilst keeping some sort of visual balance. The physical dimensions of the display region and tiles are unimportant.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void nTilesRequireGridToDisplay() { | |
assertThat(tiles(1), requiresGridOf(1, 1)); | |
assertThat(tiles(2), requiresGridOf(1, 2)); | |
assertThat(tiles(3), requiresGridOf(2, 3)); | |
assertThat(tiles(4), requiresGridOf(2, 4)); | |
assertThat(tiles(5), requiresGridOf(2, 3)); | |
assertThat(tiles(6), requiresGridOf(2, 3)); | |
assertThat(tiles(7), requiresGridOf(3, 3)); | |
assertThat(tiles(8), requiresGridOf(3, 3)); | |
assertThat(tiles(9), requiresGridOf(3, 3)); | |
assertThat(tiles(10), requiresGridOf(3, 4)); | |
assertThat(tiles(11), requiresGridOf(3, 4)); | |
assertThat(tiles(12), requiresGridOf(3, 4)); | |
assertThat(tiles(13), requiresGridOf(4, 4)); | |
assertThat(tiles(14), requiresGridOf(4, 4)); | |
assertThat(tiles(15), requiresGridOf(4, 4)); | |
assertThat(tiles(16), requiresGridOf(4, 4)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mistake in the above;