Examples of Universe


Examples of com.wakaleo.gameoflife.domain.Universe

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

        String expectedGrid = "..." + NEW_LINE + "..." + NEW_LINE + "..." + NEW_LINE + "";

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

Examples of com.wakaleo.gameoflife.domain.Universe

    @Test
    public void aUniverseSeededWithAGridWithLivingCellsContentWillContainThatGrid() {

        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

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

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

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

Examples of com.wakaleo.gameoflife.domain.Universe

    public void aUserCanAssignALiveCellAtAGivenPointInTheGrid() {
        String seededGrid = "..." + NEW_LINE + "..." + NEW_LINE + "..." + NEW_LINE + "";

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

        Universe theUniverse = new Universe(seededWith(seededGrid));
        theUniverse.setLiveCellAt(0, 0);
        theUniverse.setLiveCellAt(1, 0);
        theUniverse.setLiveCellAt(2, 1);

        assertThat(theUniverse.getGrid(), is(expectedState));
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

    public void aUserCanAssignADeadCellAtAGivenPointInTheGrid() {
        String seededGrid = "***" + NEW_LINE + "***" + NEW_LINE + "***" + NEW_LINE + "";

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

        Universe theUniverse = new Universe(seededWith(seededGrid));
        theUniverse.setDeadCellAt(0, 1);
        assertThat(theUniverse.getGrid(), is(expectedState));
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

    @Test
    public void aUserCanReadALiveCellValueAtAGivenPointInTheGrid() {
        String seededGrid = "*.." + NEW_LINE + "*.." + NEW_LINE + ".*." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(seededGrid));

        assertThat(theUniverse.getCellAt(0, 0), is(LIVE_CELL));
        assertThat(theUniverse.getCellAt(1, 0), is(LIVE_CELL));
        assertThat(theUniverse.getCellAt(2, 1), is(LIVE_CELL));
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

    @Test
    public void aUserCanReadADeadCellValueAtAGivenPointInTheGrid() {
        String seededGrid = "*.." + NEW_LINE + "*.." + NEW_LINE + ".*." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(seededGrid));

        assertThat(theUniverse.getCellAt(0, 1), is(DEAD_CELL));
        assertThat(theUniverse.getCellAt(1, 1), is(DEAD_CELL));
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

    }

    @Test
    public void aUserCanObtainTheGridContentsAsAnArrayOfCells() {
        String seededGrid = "*.." + NEW_LINE + "*.." + NEW_LINE + ".*." + NEW_LINE + "";
        Universe theUniverse = new Universe(seededWith(seededGrid));

        Cell[][] expectedCells = new Cell[][]{
                {LIVE_CELL, DEAD_CELL, DEAD_CELL},
                {LIVE_CELL, DEAD_CELL, DEAD_CELL},
                {DEAD_CELL, LIVE_CELL, DEAD_CELL},
        };

        assertThat(theUniverse.getCells(), is(expectedCells));
    }
View Full Code Here

Examples of etherstrategy.simulation.Universe

     * @throws java.lang.Exception
     */
    @Before
    public void setUp() throws Exception
    {
        testUniverse = new Universe();
        assertNotNull( "A newly constructed Universe should not be null",
                testUniverse );
    }
View Full Code Here

Examples of etherstrategy.simulation.Universe

     */
    @Ignore( "Irrelevant due to setUp()" )
    @Test
    public void constructUniverse() throws Exception
    {
        Universe testUniverse = new Universe();
        assertNotNull( "A newly constructed Universe should not be null",
                testUniverse );
        testUniverse = null;
    }
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.