@Test public void moveByFlying() throws HantoException, HantoPrematureResignationException { final PieceLocationPair[] board = new PieceLocationPair[] { plPair(BLUE, BUTTERFLY, 0, 0), plPair(RED, BUTTERFLY, 0, 1), plPair(BLUE, SPARROW, -1, 0), plPair(RED, SPARROW, 1, -1), plPair(BLUE, SPARROW, -1, 1), plPair(RED, SPARROW, 0, -1), plPair(RED, SPARROW, -2, 1) }; testGame.initializeBoard(board); testGame.setPlayerMoving(RED); testGame.setTurnNumber(4); assertEquals(RED_WINS, game.makeMove(SPARROW, makeCoordinate(-2, 1), makeCoordinate(1, 0))); }
@Test(expected = HantoException.class) public void attemptToMoveAfterGameIsOver() throws HantoException, HantoPrematureResignationException { final PieceLocationPair[] board = new PieceLocationPair[] { plPair(BLUE, BUTTERFLY, 0, 0), plPair(RED, BUTTERFLY, 0, 1), plPair(BLUE, SPARROW, -1, 0), plPair(RED, SPARROW, 1, -1), plPair(BLUE, SPARROW, -1, 1), plPair(RED, SPARROW, 0, -1), plPair(RED, CRAB, 1, 1) }; testGame.initializeBoard(board); testGame.setPlayerMoving(RED); game.makeMove(CRAB, makeCoordinate(1, 1), makeCoordinate(1, 0)); // RED wins game.makeMove(SPARROW, makeCoordinate(-1, 1), makeCoordinate(-1, 2)); }
@Test(expected = HantoException.class) public void crabWalksAndCreatesDisconnectedConfiguration() throws HantoException, HantoPrematureResignationException { final PieceLocationPair[] board = new PieceLocationPair[] { plPair(BLUE, BUTTERFLY, 0, 0), plPair(RED, BUTTERFLY, 0, 1), plPair(BLUE, SPARROW, -1, 0), plPair(RED, CRAB, 1, 0), plPair(BLUE, SPARROW, -2, 0), plPair(RED, SPARROW, 2, 0), plPair(BLUE, SPARROW, -3, 0) }; testGame.initializeBoard(board); testGame.setTurnNumber(4); testGame.setPlayerMoving(RED); game.makeMove(CRAB, makeCoordinate(1, 0), makeCoordinate(1, -1)); }