コード例 #1
0
  public void testFillGapInPotentialOpposingSeriesOfFour() throws Exception {
    board.setPosition(4, 7, Board.HUMAN_PLAYER_MARK);
    board.setPosition(5, 6, Board.HUMAN_PLAYER_MARK);
    board.setPosition(7, 3, Board.HUMAN_PLAYER_MARK);
    board.setPosition(7, 4, Board.HUMAN_PLAYER_MARK);

    assertEquals(Board.getSingleCoordValueFor(6, 5), game.makeMove());
  }
コード例 #2
0
  public void testWeCanBlockASeriesOfFour() throws Exception {
    board.setPosition(4, 5, Board.HUMAN_PLAYER_MARK);
    board.setPosition(4, 6, Board.HUMAN_PLAYER_MARK);
    board.setPosition(4, 7, Board.HUMAN_PLAYER_MARK);
    board.setPosition(4, 8, Board.HUMAN_PLAYER_MARK);

    assertEquals(Board.getSingleCoordValueFor(4, 9), game.makeMove());
  }
コード例 #3
0
  public void testFindTesseraEndingBlockingPositionBeforePairStartingPosition() throws Exception {
    board.setPosition(2, 3, Board.HUMAN_PLAYER_MARK);
    board.setPosition(3, 2, Board.HUMAN_PLAYER_MARK);
    board.setPosition(3, 3, Board.COMPUTER_PLAYER_MARK);
    board.setPosition(3, 4, Board.COMPUTER_PLAYER_MARK);
    board.setPosition(3, 5, Board.COMPUTER_PLAYER_MARK);
    board.setPosition(3, 6, Board.COMPUTER_PLAYER_MARK);

    assertEquals(Board.getSingleCoordValueFor(3, 7), game.makeMove());
  }
コード例 #4
0
 public void markMove(int position, int playerMark) {
   int row = Board.getRowCoordFor(position);
   int column = Board.getColumnCoordFor(position);
   board.setPosition(row, column, playerMark);
   view.drawMark(row, column, playerMark);
 }
コード例 #5
0
  public void testOnSecondMoveWePickShadowPosition() throws Exception {
    board.setPosition(4, 5, Board.HUMAN_PLAYER_MARK);

    int position = game.makeMove();
    assertEquals(Board.getSingleCoordValueFor(5, 4), position);
  }