Exemplo n.º 1
0
  @Test
  public void test_Jamaal_plays_zilch() {
    ZilchGame z = new ZilchGame();
    Player p, j;
    z.add(p = new Player("Jamaal"));
    z.add(j = new Player("Hussein"));

    p.addPoints(0);
    p.addPoints(0);
    p.addPoints(0);

    j.addPoints(0);
    j.addPoints(0);
    j.addPoints(0);

    j.addPoints(0);
    j.addPoints(0);
    j.addPoints(0);

    assertEquals((-1000), j.getScore());

    ArrayList<Die> dice = z.getDice();

    dice.get(0).setFace(1);

    Player pablo = z.getCurrentPlayer();

    int score = z.getScore(pablo);

    pablo.play(new boolean[] {true, false, false, false, false, false});

    assertEquals(5, z.getDice().size());

    dice = z.getDice();

    dice.get(0).setFace(3);
    pablo.play(new boolean[] {true, false, false, false, false});
    System.out.println(z.getScore(pablo));
    System.out.println(score);
    System.out.println(pablo.getName());

    assertTrue(z.getScore(pablo) + 1000 == score);
  }
Exemplo n.º 2
0
 @Test
 public void testGetDice() {
   ZilchGame game = new ZilchGame();
   assertEquals(6, game.getDice().size());
 }
Exemplo n.º 3
0
 private void setAndPlayFirstDice(ZilchGame z, int i) {
   System.out.println(z.getDice().size());
   z.getDice().get(0).setFace(i);
   z.getCurrentPlayer().play(new boolean[] {true});
 }