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