Examples of Universe


Examples of com.wakaleo.gameoflife.domain.Universe

            e.printStackTrace();
        }
    }

    private Universe universeInstanciatedByDimensions(final int rows, final int columns) {
        Universe universe = new Universe(rows, columns);
        for (int row = 0; row < rows; row++) {
            for (int column = 0; column < columns; column++) {
                universe.setDeadCellAt(row, column);
            }
        }
        return universe;
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

    }

    private Universe universeInstanciatedFromClickedCells(final int rows,
                                                          final int columns,
                                                          final HttpServletRequest request) {
        Universe universe = universeInstanciatedByDimensions(rows, columns);
        for (int row = 0; row < rows; row++) {
            for (int column = 0; column < columns; column++) {
                if (cellWasClickedAt(row, column, request)) {
                    universe.setLiveCellAt(row, column);
                }
            }
        }
        return universe;
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

        String expectedNextGrid = "..." + NEW_LINE +
                "..." + NEW_LINE +
                "..." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(initialGrid));
        theUniverse.createNextGeneration();

        String nextGrid = theUniverse.getGrid();
        assertThat(nextGrid, is(expectedNextGrid));
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

        String expectedNextGrid = "..." + NEW_LINE +
                "..." + NEW_LINE +
                "..." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(initialGrid));
        theUniverse.createNextGeneration();

        String nextGrid = theUniverse.getGrid();
        assertThat(nextGrid, is(expectedNextGrid));
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

        String expectedNextGrid = "**." + NEW_LINE +
                "**." + NEW_LINE +
                "..." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(initialGrid));
        theUniverse.createNextGeneration();

        String nextGrid = theUniverse.getGrid();
        assertThat(nextGrid, is(expectedNextGrid));
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

        String expectedNextGrid = ".*." + NEW_LINE +
                ".*." + NEW_LINE +
                ".*." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(initialGrid));
        theUniverse.createNextGeneration();

        String nextGrid = theUniverse.getGrid();
        assertThat(nextGrid, is(expectedNextGrid));
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

        String expectedNextGrid = "..." + NEW_LINE +
                "..." + NEW_LINE +
                "..." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(initialGrid));
        theUniverse.createNextGeneration();

        String nextGrid = theUniverse.getGrid();
        assertThat(nextGrid, is(expectedNextGrid));
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

    public static final String EMPTY_GRID = "..." + NEW_LINE + "..." + NEW_LINE + "..." + NEW_LINE + "";

    @Test
    public void aNewUniverseShouldContainOnlyDeadCells() {
        Universe theUniverse = new Universe();
        String currentGrid = theUniverse.getGrid();
        assertThat(currentGrid, is(EMPTY_GRID));
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

    @Test
    public void aUniverseSeededWithAnEmpyGridContentWillContainAnEmptyGrid() {

        String seededGrid = "..." + NEW_LINE + "..." + NEW_LINE + "..." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(seededGrid));
        String currentGrid = theUniverse.getGrid();
        assertThat(currentGrid, is(seededGrid));
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

    @Test
    public void aUniverseCanBeInitializedWithAnyDimension() {
        String expectedGrid = "....." + NEW_LINE + "....." + NEW_LINE + "....." + NEW_LINE + "....." + NEW_LINE + "";

        Universe theUniverse = new Universe(4, 5);
        String currentGrid = theUniverse.getGrid();
        assertThat(currentGrid, is(expectedGrid));

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.