Add a condition to avoid white piece
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Mat 2023-05-17 23:49:21 +02:00
parent 3d4730cfc0
commit d37059b7de

View File

@ -6,6 +6,8 @@ import javafx.scene.paint.Paint;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import static javafx.scene.paint.Color.color;
/** /**
* Represent a Piece in the game. * Represent a Piece in the game.
* Every Piece should be contained in a Map Object. * Every Piece should be contained in a Map Object.
@ -22,6 +24,9 @@ public class Piece extends Shape{
super(matrix); super(matrix);
Random rand = new Random(); Random rand = new Random();
color = new Color(rand.nextDouble(), rand.nextDouble(), rand.nextDouble(), 1); color = new Color(rand.nextDouble(), rand.nextDouble(), rand.nextDouble(), 1);
while(color.equals(color(255, 255, 255))) {
color = new Color(rand.nextDouble(), rand.nextDouble(), rand.nextDouble(), 1);
}
} }
public void setColor(Paint p){ public void setColor(Paint p){