Beispiel #1
0
 public static Species getRandomSpecies() {
   PkmType t = PkmType.values()[rand.nextInt(PkmType.values().length)];
   Predicate<Species> filter = species -> species.getType().equals(t);
   List<Species> options = new ArrayList<Species>(mngr.getSpeciesByFilters(Arrays.asList(filter)));
   if (options.isEmpty()) {
     options = Arrays.asList(Species.AIR);
   }
   return options.get(rand.nextInt(options.size()));
 }
Beispiel #2
0
 /** Test method for {@link shuffle.fwk.data.Board#isFrozenAt(int, int)}. */
 @Test
 public final void testIsFrozenAt() {
   Board b = new Board();
   for (int row = 1; row <= Board.NUM_ROWS; row++) {
     for (int col = 1; col <= Board.NUM_COLS; col++) {
       assertFalse("incorrectly frozen by default.", b.isFrozenAt(row, col));
       b.setSpeciesAt(row, col, mngr.getSpeciesByName("Wood"));
       b.setFrozenAt(row, col, true);
       assertTrue("incorrectly thawed after intsertion and freeze.", b.isFrozenAt(row, col));
     }
   }
 }