Package vrampal.connectfour.core

Examples of vrampal.connectfour.core.Player


    game.drawGame();
  }

  @Test(expected = ConnectFourException.class)
  public void testVistoryBeforeBegin() {
    Player winner = createPlayer();

    game.victory(winner);
  }
View Full Code Here


    board = new BoardImpl(3, 0);
  }

  @Test
  public void testGetEmptyPlayer() {
    Player emptyPlayer = board.getEmptyPlayer();
    assertEquals(BoardImpl.EMPTY_PLAYER, emptyPlayer);
    assertNotNull(emptyPlayer);
  }
View Full Code Here

  // ----- One player tests -----

  @Test
  public void testDropDisc() {
    Player player1 = mock(Player.class);
    GameEndListener endGameListener = mock(GameEndListener.class);
    board.setEndGameListener(endGameListener);

    board.dropDisc(player1, 3);
    assertSame(player1, board.getCell(3, 0));
View Full Code Here

  // ----- Two players tests -----

  @Test(expected = ConnectFourException.class)
  public void testDropDiscFull() {
    Player player1 = mock(Player.class);
    Player player2 = mock(Player.class);

    board.dropDisc(player1, 3);
    board.dropDisc(player2, 3);
    board.dropDisc(player1, 3);
    board.dropDisc(player2, 3);
View Full Code Here

    board.dropDisc(player1, 3);
  }

  @Test
  public void testUpToVictoryHorizontal() {
    Player player1 = mock(Player.class);
    GameEndListener endGameListener = mock(GameEndListener.class);
    board.setEndGameListener(endGameListener);

    board.dropDisc(player1, 4);
    board.dropDisc(player1, 5);
View Full Code Here

    verify(endGameListener, never()).drawGame();
  }

  @Test
  public void testUpToVictoryVertical() {
    Player player1 = mock(Player.class);
    Player player2 = mock(Player.class);
    GameEndListener endGameListener = mock(GameEndListener.class);
    board.setEndGameListener(endGameListener);

    board.dropDisc(player2, 3);
    board.dropDisc(player1, 3);
View Full Code Here

    verify(endGameListener, never()).drawGame();
  }

  @Test
  public void testUpToVictoryDiaginal1() {
    Player player1 = mock(Player.class);
    Player player2 = mock(Player.class);
    GameEndListener endGameListener = mock(GameEndListener.class);
    board.setEndGameListener(endGameListener);

    board.dropDisc(player1, 4);
    board.dropDisc(player2, 3);
View Full Code Here

    verify(endGameListener, never()).drawGame();
  }

  @Test
  public void testUpToVictoryDiaginal2() {
    Player player1 = mock(Player.class);
    Player player2 = mock(Player.class);
    GameEndListener endGameListener = mock(GameEndListener.class);
    board.setEndGameListener(endGameListener);

    board.dropDisc(player1, 2);
    board.dropDisc(player2, 3);
View Full Code Here

    verify(endGameListener, never()).drawGame();
  }

  @Test
  public void testUpToDraw() {
    Player player1 = mock(Player.class);
    Player player2 = mock(Player.class);
    GameEndListener endGameListener = mock(GameEndListener.class);
    board.setEndGameListener(endGameListener);

    board.dropDisc(player1, 0);
    board.dropDisc(player2, 1);
View Full Code Here

    width = inBoard.getWidth();
    height = inBoard.getHeight();
    board = new char[width * height];
    for (int colIdx = 0; colIdx < width; colIdx++) {
      for (int rowIdx = 0; rowIdx < height; rowIdx++) {
        Player curCell = inBoard.getCell(colIdx, rowIdx);
        board[(colIdx * height) + rowIdx] = curCell.getLetter();
      }
    }

    status = in.getStatus();
    turnNumber = in.getTurnNumber();
    Player inWinner = in.getWinner();
    if (inWinner == null) {
      winner = null;
    } else {
      winner = inWinner.toString();
    }
  }
View Full Code Here

TOP

Related Classes of vrampal.connectfour.core.Player

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.