Add a condition to avoid white piece #65
@ -24,7 +24,7 @@ public class Piece extends Shape{
|
||||
super(matrix);
|
||||
Random rand = new Random();
|
||||
color = new Color(rand.nextDouble(), rand.nextDouble(), rand.nextDouble(), 1);
|
||||
while(color.equals(color(255, 255, 255))) {
|
||||
while(color.equals(Color.WHITE)) {
|
||||
|
||||
color = new Color(rand.nextDouble(), rand.nextDouble(), rand.nextDouble(), 1);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user
https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextDouble--
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/paint/Color.html#color-double-double-double-
Les valeurs sont entre 0 et 1 et pas entre 0 et 255