code cleanup
Dieser Commit ist enthalten in:
Ursprung
cabb09a674
Commit
2c981f29ce
@ -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);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren