@Override public void run(GameState gameState, MoveMaker move) throws AssertionError, UnsupportedOperationException, IllegalArgumentException { if (1 == 1) { throw new IllegalArgumentException(); } gameState.setWhoseTurn(0); Collection<Card> hand = new ArrayList<Card>(); hand.add(Card.CONSUL); gameState.setPlayerHand(0, hand); gameState.setPlayerSestertii(0, 10); move.placeCard(Card.CONSUL, Rules.DICE_DISC_2); gameState.setActionDice(new int[] {2, 2, 2}); ConsulActivator activator = (ConsulActivator) move.chooseCardToActivate(Rules.DICE_DISC_2); activator.chooseConsulChangeAmount(1); activator.chooseWhichDiceChanges(2); activator.complete(); int[] dice = gameState.getActionDice(); boolean found = false; for (int die : dice) { if (die == 3) { found = true; } } assert (found); }
@Override public void run(GameState gameState, MoveMaker move) throws AssertionError, UnsupportedOperationException, IllegalArgumentException { // Check that players can have no sestertii gameState.setPlayerSestertii(0, 0); gameState.setPlayerSestertii(1, 0); assert (gameState.getPlayerSestertii(0) == 0); assert (gameState.getPlayerSestertii(1) == 0); // Check that players can have different numbers of sestertii gameState.setPlayerSestertii(0, 5); gameState.setPlayerSestertii(1, 10); assert (gameState.getPlayerSestertii(0) == 5); assert (gameState.getPlayerSestertii(1) == 10); // Check that it is possible to set each player's sestertii // individually gameState.setPlayerSestertii(0, 20); assert (gameState.getPlayerSestertii(0) == 20); assert (gameState.getPlayerSestertii(1) == 10); gameState.setPlayerSestertii(1, 1); assert (gameState.getPlayerSestertii(0) == 20); assert (gameState.getPlayerSestertii(1) == 1); }
private void assertVPs() { int poolVPs = 36; for (int i = 0; i < Rules.NUM_PLAYERS; i++) { poolVPs -= playerVPs[i]; assert (gameState.getPlayerVictoryPoints(i) == playerVPs[i]); } assert (gameState.getPoolVictoryPoints() == poolVPs); }
public void run(GameState gameState, MoveMaker move) throws AssertionError, UnsupportedOperationException, IllegalArgumentException { this.gameState = gameState; /* Starting Process: * Initialises Deck to a pre-determined deck * Initialises Field to empty fields * Initialises Hands to empty hands * Initialises Players' VPs to 10 * Initialises Players' Sestertiis to 0 */ initialiseDeck(); initialiseDiscard(); gameState.setDeck(deck); gameState.setDiscard(discard); assertDeck(); initialisePlayerFields(); transferFieldsToState(); assertFields(); initialisePlayerHands(); transferHandsToState(); assertHands(); initialisePlayerVPs(); transferVPsToState(); initialisePlayerSestertiis(); transferSestertiiToState(); assertVPs(); assertSestertiis(); /* Set Hands: * Gives each Player their first 5 cards * Sets those cards in predetermined positions * Initialises to Player 1's turn */ for (int i = 0; i < Rules.NUM_PLAYERS; i++) { for (int j = 0; j < 5; j++) { playerHands[i].add(deck.remove(0)); } } /* Hands: Player 1 Player 2: LEGIONARIUS MERCATOR SENATOR TRIBUNUSPLEBIS PRAETORIANUS CONSILIARIUS ARCHITECTUS SCAENICUS TRIBUNUSPLEBIS HARUSPEX Place onto Fields: 1 2 3 4 5 6 7 Player 1:<PRAETORIANUS>,<SENATOR>,<TRIBUNUSPLEBIS>,<LEGIONARIUS>,<NOT_A_CARD>,<ARCHITECTUS>,<NOT_A_CARD> Player 2:<MERCATOR>,<NOT_A_CARD>,<TRIBUNUSPLEBIS>,<CONSILIARIUS>, <HARUSPEX>,<NOT_A_CARD>,<SCAENICUS> */ playerHands[PLAYER_1] = new ArrayList<Card>(); playerHands[PLAYER_2] = new ArrayList<Card>(); playerFields[PLAYER_1] = new Card[] { Card.PRAETORIANUS, Card.SENATOR, Card.TRIBUNUSPLEBIS, Card.LEGIONARIUS, Card.NOT_A_CARD, Card.ARCHITECTUS, Card.NOT_A_CARD }; playerFields[PLAYER_2] = new Card[] { Card.MERCATOR, Card.NOT_A_CARD, Card.TRIBUNUSPLEBIS, Card.CONSILIARIUS, Card.HARUSPEX, Card.NOT_A_CARD, Card.SCAENICUS }; gameState.setDeck(deck); transferHandsToState(); transferFieldsToState(); assertHands(); assertFields(); gameState.setWhoseTurn(PLAYER_1); gameState.setActionDice(new int[] {1, 3, 4}); PraetorianusActivator cockBlock = (PraetorianusActivator) move.chooseCardToActivate(Rules.DICE_DISC_1); cockBlock.chooseDiceDisc(Rules.DICE_DISC_3); cockBlock.complete(); discard.add(Card.CONSILIARIUS); playerFields[PLAYER_2][3] = Card.NOT_A_CARD; LegionariusActivator stabbyStabby = (LegionariusActivator) move.chooseCardToActivate(Rules.DICE_DISC_4); stabbyStabby.giveAttackDieRoll(6); stabbyStabby.complete(); assertDiscard(); assertFields(); playerVPs[PLAYER_1] += 1; playerVPs[PLAYER_2] -= 1; TribunusPlebisActivator plebs = (TribunusPlebisActivator) move.chooseCardToActivate(Rules.DICE_DISC_3); plebs.complete(); assertVPs(); move.endTurn(); /* Start of Round Summary Victory Points: Player 1: 11 Player 2: 6 Pool: 16 Sestertii: Player 1: 0 Player 2: 0 Hands: Player 1: Player 2: Fields: 1 2 3 4 5 6 7 Player 1:<PRAETORIANUS>,<SENATOR>,<TRIBUNUSPLEBIS>,<LEGIONARIUS>,<NOT_A_CARD>,<ARCHITECTUS>,<NOT_A_CARD> Player 2:<MERCATOR>,<NOT_A_CARD>,<TRIBUNUSPLEBIS>,<NOT_A_CARD>, <HARUSPEX>, <NOT_A_CARD>, <SCAENICUS> */ playerVPs[PLAYER_2] -= 3; assertVPs(); gameState.setActionDice(new int[] {3, 3, 4}); deck.remove(Card.GRIMREAPER); deck.remove(Card.LEGAT); deck.remove(Card.KAT); discard.add(Card.LEGAT); discard.add(Card.KAT); playerHands[PLAYER_2].add(Card.GRIMREAPER); move.activateCardsDisc(3, Card.GRIMREAPER); assertDeck(); assertDiscard(); assertHands(); playerSestertiis[PLAYER_2] += 4; move.activateMoneyDisc(4); assertSestertiis(); // THE DISC IS BLOCKED! plebs = (TribunusPlebisActivator) move.chooseCardToActivate(Rules.DICE_DISC_3); plebs.complete(); assertVPs(); // TRY MIMICING THE BLOCKED DISC - Thanks Matt Moss :) playerSestertiis[PLAYER_2] -= 3; playerVPs[PLAYER_2] += 1; playerVPs[PLAYER_1] -= 1; ScaenicusActivator ditto = (ScaenicusActivator) move.activateBribeDisc(3); plebs = (TribunusPlebisActivator) ditto.getScaenicusMimicTarget(Rules.DICE_DISC_3); plebs.complete(); ditto.complete(); assertSestertiis(); assertVPs(); move.endTurn(); /* Start of Round Summary Victory Points: Player 1: 8 Player 2: 7 Pool: 16 Sestertii: Player 1: 0 Player 2: 1 Hands: Player 1: Player 2: Fields: 1 2 3 4 5 6 7 Player 1:<PRAETORIANUS>,<SENATOR>,<TRIBUNUSPLEBIS>,<LEGIONARIUS>,<NOT_A_CARD>,<ARCHITECTUS>,<NOT_A_CARD> Player 2:<MERCATOR>,<NOT_A_CARD>,<TRIBUNUSPLEBIS>,<NOT_A_CARD>, <HARUSPEX>, <NOT_A_CARD>, <SCAENICUS> */ playerVPs[PLAYER_1] -= 2; assertVPs(); }
private void assertSestertiis() { for (int i = 0; i < Rules.NUM_PLAYERS; i++) { assert (gameState.getPlayerSestertii(i) == playerSestertiis[i]); } }
private void assertHands() { for (int i = 0; i < Rules.NUM_PLAYERS; i++) { assert (gameState.getPlayerHand(i).containsAll(playerHands[i])); } }
private void assertFields() { for (int i = 0; i < Rules.NUM_PLAYERS; i++) { assert (Arrays.equals(gameState.getPlayerCardsOnDiscs(i), playerFields[i])); } }
private void assertDiscard() { gameState.getDiscard().equals(discard); }
private void assertDeck() { gameState.getDeck().equals(deck); }
@Override public void run(GameState gameState, MoveMaker move) throws AssertionError, UnsupportedOperationException, IllegalArgumentException { gameState.setWhoseTurn(0); gameState.setPlayerVictoryPoints(0, 10); gameState.setPlayerVictoryPoints(1, 10); gameState.setPlayerSestertii(0, 30); assert (gameState.getPoolVictoryPoints() == 16); Collection<Card> hand = new ArrayList<Card>(); hand.add(Card.FORUM); hand.add(Card.BASILICA); gameState.setPlayerHand(0, hand); // no cards on the field Card[] field = new Card[Rules.NUM_DICE_DISCS]; for (int i = 0; i < field.length; i++) { field[i] = Card.NOT_A_CARD; } gameState.setPlayerCardsOnDiscs(0, field); gameState.setPlayerCardsOnDiscs(1, field); gameState.setActionDice(new int[] {2, 2, 2}); // ================ test starts =================== move.placeCard(Card.FORUM, Rules.DICE_DISC_2); assert (gameState.getPlayerSestertii(0) == 25); move.placeCard(Card.BASILICA, Rules.DICE_DISC_1); assert (gameState.getPlayerSestertii(0) == 19); ForumActivator activator = (ForumActivator) move.chooseCardToActivate(Rules.DICE_DISC_2); activator.chooseActionDice(2); activator.chooseActivateTemplum(false); activator.complete(); assert (gameState.getPlayerVictoryPoints(0) == 14); assert (gameState.getPoolVictoryPoints() == 12); }