Package org.jpacman.framework.model

Examples of org.jpacman.framework.model.Game


   *
   * @throws FactoryException Can't happen.
   */
  @Test
  public void testC6_GhostMovesToFood() throws FactoryException {
    Game game = makePlay("G.#");
    Ghost theGhost = (Ghost) game.getBoard().spriteAt(0, 0);

    game.moveGhost(theGhost, Direction.RIGHT);   
    assertEquals("Ghost moved", tileAt(game, 1, 0), theGhost.getTile());

    game.moveGhost(theGhost, Direction.LEFT);
    assertEquals(SpriteType.FOOD, game.getBoard().spriteTypeAt(1, 0));
  }
View Full Code Here


   * @throws FactoryException Never.
   */
  @Test
  public void testObserverAfterPlayerMove() throws FactoryException {
    Observer anObserver = mock(Observer.class);
    Game g = makePlay("P #");
    g.addObserver(anObserver);
   
    g.movePlayer(Direction.RIGHT);
    verify(anObserver).update(any(Observable.class), anyObject());
  }
View Full Code Here

   */
  @Test
  public void testObserverAfterGhostMove() throws FactoryException {
    // given
    Observer anObserver = mock(Observer.class);
    Game game = makePlay("G #");
    game.addObserver(anObserver);
    Ghost ghost = (Ghost) game.getBoard().spriteAt(0, 0);
    // when
    game.moveGhost(ghost, Direction.RIGHT);
    // then
    verify(anObserver).update(any(Observable.class), anyObject());
  }
View Full Code Here

   *
   * @throws FactoryException Never.
   */
  @Test
  public void testTunneledMove() throws FactoryException {
    Game g = makePlay("P# ");
    g.movePlayer(Direction.LEFT);
   
    Tile newTile = g.getPlayer().getTile();
    assertThat("Player moved", tileAt(g, 2, 0), equalTo(newTile));
  }
View Full Code Here

        int width = map[0].length();
        if (width == 0) {
          throw new FactoryException("Empty row encountered.");
        }
       
        Game theGame = factory.makeGame();
        theBoard = factory.makeBoard(width, height);
       
        for (int y = 0; y < height; y++) {
            if (map[y].length() != width) {
              throw new FactoryException(
View Full Code Here

  private transient Game theGame;
 
  @Override
  public Game makeGame() {
    theGame = new Game();
    return theGame;
  }
View Full Code Here

TOP

Related Classes of org.jpacman.framework.model.Game

Copyright © 2018 www.massapicom. 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.