12
1
Dieser Commit ist enthalten in:
Zeanon 2021-05-14 00:30:49 +02:00
Ursprung cabb09a674
Commit 2c981f29ce

Datei anzeigen

@ -29,7 +29,7 @@ public class HellsBells {
EAST(1, 0, 0, false), EAST(1, 0, 0, false),
WEST(-1, 0, 0, false); WEST(-1, 0, 0, false);
static final List<Direction> DIRECTIONS = Arrays.asList(values()); static final Direction[] DIRECTIONS = values();
int dx; int dx;
int dy; int dy;
@ -43,6 +43,10 @@ public class HellsBells {
this.zLength = zLength; this.zLength = zLength;
} }
public static Direction getRandom() {
return Direction.DIRECTIONS[random.nextInt(Direction.DIRECTIONS.length)];
}
Direction other() { Direction other() {
switch (this) { switch (this) {
case NORTH: case NORTH:
@ -130,7 +134,7 @@ public class HellsBells {
} }
public void drop() { public void drop() {
Direction direction = Direction.DIRECTIONS.get(random.nextInt(Direction.DIRECTIONS.size())); Direction direction = Direction.getRandom();
AtomicInteger length = new AtomicInteger(10 + random.nextInt((direction.zLength ? zLength : xLength) - 10)); AtomicInteger length = new AtomicInteger(10 + random.nextInt((direction.zLength ? zLength : xLength) - 10));
int width = 5 + random.nextInt(5); int width = 5 + random.nextInt(5);