@Test public void testPlayImplOthelloPlayerOthelloPlayerOthelloBoardIntRandomDataGenerator() throws Exception { RandomDataGenerator random = new RandomDataGenerator(new MersenneTwister(123)); Othello othello = new Othello(); { OthelloBoard initialBoard = new OthelloBoard(new int[][] { { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 0 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 0, 1 }, }); OthelloBoard expectedBoard = new OthelloBoard(new int[][] { { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 0 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, }); OthelloWPCPlayer player = new OthelloStandardWPCHeuristicPlayer().create(); OthelloBoard result = othello.playImpl(player, player, initialBoard, Board.BLACK, random); Assert.assertEquals(expectedBoard, result); } { OthelloBoard board = new OthelloBoard(new int[][] { { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 0 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 1 }, }); OthelloBoard expectedBoard = new OthelloBoard(new int[][] { { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 0 }, { 2, 2, 2, 2, 2, 2, 2, 0 }, { 2, 2, 2, 2, 2, 2, 2, 0 }, }); OthelloWPCPlayer player = new OthelloStandardWPCHeuristicPlayer().create(); OthelloBoard result = new Othello().playImpl(player, player, board, Board.WHITE, random); Assert.assertEquals(expectedBoard, result); } { OthelloBoard initialBoard = new OthelloBoard(new int[][] { { 1, 2, 0, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 0 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 0, 1 }, }); OthelloBoard expectedBoard = new OthelloBoard(new int[][] { { 0, 0, 0, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 0 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, }); OthelloWPCPlayer player = new OthelloStandardWPCHeuristicPlayer().create(); OthelloBoard result = new Othello().playImpl(player, player, initialBoard, Board.BLACK, random); Assert.assertEquals(expectedBoard, result); } { OthelloBoard initialBoard = new OthelloBoard(new int[][] { { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 1, 0, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 0 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 0, 1 }, }); OthelloBoard expectedBoard = new OthelloBoard(new int[][] { { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 0 }, { 2, 2, 2, 2, 2, 2, 2, 0 }, { 2, 2, 2, 2, 2, 2, 0, 0 }, }); OthelloWPCPlayer player = new OthelloStandardWPCHeuristicPlayer().create(); OthelloBoard result = new Othello().playImpl(player, player, initialBoard, Board.WHITE, random); Assert.assertEquals(expectedBoard, result); } }
OthelloBoard playImpl(OthelloPlayer blackPlayer, OthelloPlayer whitePlayer, RandomDataGenerator random) { return playImpl(blackPlayer, whitePlayer, new OthelloBoard(), OthelloBoard.BLACK, random); }
Othello implements BoardGame<OthelloPlayer, OthelloPlayer, OthelloState> { OthelloBoard playImpl(OthelloPlayer blackPlayer, OthelloPlayer whitePlayer, RandomDataGenerator random) { return playImpl(blackPlayer, whitePlayer, new OthelloBoard(), OthelloBoard.BLACK, random); } }
Othello implements BoardGame<OthelloPlayer, OthelloPlayer, OthelloState> { OthelloBoard playImpl(OthelloPlayer blackPlayer, OthelloPlayer whitePlayer, RandomDataGenerator random) { return playImpl(blackPlayer, whitePlayer, new OthelloBoard(), OthelloBoard.BLACK, random); } Othello();  Othello(GameResultEvaluator boardEvaluator);  Othello(double randomMoveProbability);  Othello(double randomMoveProbability, int randomMoveMaxTurns);  Othello(double randomMoveProbabilityForBlack, double randomMoveProbabilityForWhite);  Othello(double randomMoveProbabilityForBlack, double randomMoveProbabilityForWhite, int randomMoveMaxTurns);  Othello(GameResultEvaluator boardEvaluator, double randomMoveProbabilityForBlack,
			double randomMoveProbabilityForWhite);  Othello(GameResultEvaluator boardEvaluator, double randomMoveProbabilityForBlack,
			double randomMoveProbabilityForWhite, int randomMoveMaxTurns); }
Othello implements BoardGame<OthelloPlayer, OthelloPlayer, OthelloState> { OthelloBoard playImpl(OthelloPlayer blackPlayer, OthelloPlayer whitePlayer, RandomDataGenerator random) { return playImpl(blackPlayer, whitePlayer, new OthelloBoard(), OthelloBoard.BLACK, random); } Othello();  Othello(GameResultEvaluator boardEvaluator);  Othello(double randomMoveProbability);  Othello(double randomMoveProbability, int randomMoveMaxTurns);  Othello(double randomMoveProbabilityForBlack, double randomMoveProbabilityForWhite);  Othello(double randomMoveProbabilityForBlack, double randomMoveProbabilityForWhite, int randomMoveMaxTurns);  Othello(GameResultEvaluator boardEvaluator, double randomMoveProbabilityForBlack,
			double randomMoveProbabilityForWhite);  Othello(GameResultEvaluator boardEvaluator, double randomMoveProbabilityForBlack,
			double randomMoveProbabilityForWhite, int randomMoveMaxTurns); GameResultEvaluator getBoardEvaluator(); @Override GameOutcome play(OthelloPlayer blackPlayer, OthelloPlayer whitePlayer, RandomDataGenerator random); @Override GameOutcome play(OthelloPlayer blackPlayer, OthelloPlayer whitePlayer, OthelloState initialState,
			RandomDataGenerator random); }
Othello implements BoardGame<OthelloPlayer, OthelloPlayer, OthelloState> { OthelloBoard playImpl(OthelloPlayer blackPlayer, OthelloPlayer whitePlayer, RandomDataGenerator random) { return playImpl(blackPlayer, whitePlayer, new OthelloBoard(), OthelloBoard.BLACK, random); } Othello();  Othello(GameResultEvaluator boardEvaluator);  Othello(double randomMoveProbability);  Othello(double randomMoveProbability, int randomMoveMaxTurns);  Othello(double randomMoveProbabilityForBlack, double randomMoveProbabilityForWhite);  Othello(double randomMoveProbabilityForBlack, double randomMoveProbabilityForWhite, int randomMoveMaxTurns);  Othello(GameResultEvaluator boardEvaluator, double randomMoveProbabilityForBlack,
			double randomMoveProbabilityForWhite);  Othello(GameResultEvaluator boardEvaluator, double randomMoveProbabilityForBlack,
			double randomMoveProbabilityForWhite, int randomMoveMaxTurns); GameResultEvaluator getBoardEvaluator(); @Override GameOutcome play(OthelloPlayer blackPlayer, OthelloPlayer whitePlayer, RandomDataGenerator random); @Override GameOutcome play(OthelloPlayer blackPlayer, OthelloPlayer whitePlayer, OthelloState initialState,
			RandomDataGenerator random);  }