DownDate to java 11
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Debucquoy Anthony 2023-05-04 22:12:13 +02:00
parent 53972cd1ef
commit a7a3e8b36e
Signed by: tonitch
GPG Key ID: A78D6421F083D42E
3 changed files with 17 additions and 9 deletions

View File

@ -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++) {

View File

@ -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;
}

View File

@ -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;