예제 #1
0
 @Test
 public void testFindPath() {
   Node node = board.getNode(SUSPECTS[0], Direction.NORTH);
   assertFalse("Should not be a path", node.isPath());
   board.findPaths(SUSPECTS[0], 2);
   assertTrue("Should be a path", node.isPath());
   board.clearPaths();
   assertFalse("Should not be a path", node.isPath());
 }
예제 #2
0
  /**
   * Sets up the board.
   *
   * @throws IOException
   * @throws InterruptedException
   */
  @Before
  public void before() throws IOException, InterruptedException {

    Suspect[] SUSPECTS1 = {
      new Suspect("Miss Scarlett", "scarlett", 8, 25),
      new Suspect("Colonel Mustard", "mustard", 1, 18),
      new Suspect("Mrs White", "white", 10, 1),
      new Suspect("Rev Green", "green", 15, 1),
      new Suspect("Mrs Peacock", "peacock", 24, 7),
      new Suspect("Professor Plum", "plum", 24, 20)
    };

    SUSPECTS = SUSPECTS1;

    List<Weapon> weapons = new ArrayList<Weapon>();
    weapons.addAll(Arrays.asList(WEAPONS));
    List<Room> rooms = new ArrayList<Room>();
    rooms.addAll(Arrays.asList(ROOMS));
    List<Suspect> suspects = new ArrayList<Suspect>();
    suspects.addAll(Arrays.asList(SUSPECTS));

    deck = new Deck(weapons, rooms, suspects);

    gameEngine = new GameEngine();
    gameEngine.setNumberOfPlayers(3);
    gameEngine.addPlayer("scarlett", "David");
    gameEngine.addPlayer("mustard", "Pauline");
    gameEngine.addPlayer("white", "David Again");
    board = gameEngine.getBoard();
    boardPanel = new BoardPanel(gameEngine);
    board.addBoardPanel(boardPanel);
    gameEngine.startGame();
  }
예제 #3
0
 @Test
 public void testGetRightNode() {
   Node node = board.getNode(SUSPECTS[0], Direction.NORTH);
   assertEquals("Should be 8", 8, node.getPoint().x);
   assertEquals("Should be 24", 24, node.getPoint().y);
   assertTrue("Should be able to move back south", node.canMove(Direction.SOUTH));
 }
예제 #4
0
 @Test
 public void testMovePlayerSomewhere() {
   assertEquals("Should be 8", 8, SUSPECTS[0].getGridX());
   assertEquals("Should be 25", 25, SUSPECTS[0].getGridY());
   gameEngine.setSuspectOnNode(board.getNode(new Point(11, 10)), SUSPECTS[0]);
   assertEquals("Should be 11", 11, SUSPECTS[0].getGridX());
   assertEquals("Should be 10", 10, SUSPECTS[0].getGridY());
 }
예제 #5
0
 @Test
 public void testMovement() {
   assert (deck != null);
   assertTrue("Should be able to move", board.canMoveDir(SUSPECTS[0], Direction.NORTH));
   assertFalse("Should not be able to move", board.canMoveDir(SUSPECTS[0], Direction.SOUTH));
 }
예제 #6
0
 @Test
 public void testTokens() {
   assertEquals("Should be twelve tokens on the board", 12, board.getTokens().length);
 }