DownDate to java 11
This commit is contained in:
parent
53972cd1ef
commit
a7a3e8b36e
@ -20,13 +20,19 @@ public class MapGenerator {
|
||||
|
||||
// define map size depending on the difficulty
|
||||
switch (difficulty){
|
||||
case Easy -> map_size = new Vec2(rand.nextInt(3, 5), rand.nextInt(3, 5));
|
||||
case Medium -> map_size = new Vec2(rand.nextInt(5, 8), rand.nextInt(5, 8));
|
||||
case Difficult -> {
|
||||
map_size = new Vec2(rand.nextInt(8, 10), rand.nextInt(8, 10));
|
||||
case Easy:
|
||||
map_size = new Vec2(rand.nextInt(2) + 3, rand.nextInt(2) + 3);
|
||||
break;
|
||||
case Medium:
|
||||
map_size = new Vec2(rand.nextInt(3)+5, rand.nextInt(3)+5);
|
||||
break;
|
||||
case Difficult:
|
||||
map_size = new Vec2(rand.nextInt(2)+8, rand.nextInt(2)+8);
|
||||
depth = 2;
|
||||
}
|
||||
default -> map_size = new Vec2();
|
||||
break;
|
||||
default:
|
||||
map_size = new Vec2();
|
||||
break;
|
||||
}
|
||||
|
||||
// Cut edges
|
||||
@ -57,7 +63,7 @@ public class MapGenerator {
|
||||
while (EmptySlots.size() > 0){
|
||||
Collections.shuffle(EmptySlots);
|
||||
Vec2 selected = EmptySlots.get(0);
|
||||
int size = rand.nextInt(1, 4);
|
||||
int size = rand.nextInt(3)+1;
|
||||
boolean[][] shape = new boolean[size][size];
|
||||
for(int i = 0; i < size; i++){
|
||||
for (int j = 0; j < size; j++) {
|
||||
|
@ -68,7 +68,8 @@ public class Piece extends Shape{
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj instanceof Piece pieceObj){
|
||||
if(obj instanceof Piece){
|
||||
Piece pieceObj = (Piece) obj;
|
||||
if( pieceObj.getPosition().equals(this.getPosition()) && pieceObj.getShape().equals(getShape())) {
|
||||
return true;
|
||||
}
|
||||
|
@ -21,7 +21,8 @@ public class Vec2 implements Serializable {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Vec2 vec) {
|
||||
if (obj instanceof Vec2) {
|
||||
Vec2 vec = (Vec2) obj;
|
||||
return this.x == vec.x && this.y == vec.y;
|
||||
}
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user