Add a condition to avoid white piece #65

Closed
Mat_02 wants to merge 3 commits from delete_white_piece into master
Showing only changes of commit fbd214bc23 - Show all commits

View File

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

https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextDouble--

Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.

https://docs.oracle.com/javase/8/javafx/api/javafx/scene/paint/Color.html#color-double-double-double-

Creates an opaque sRGB color with the specified red, green and blue values in the range 0.0-1.0.

Les valeurs sont entre 0 et 1 et pas entre 0 et 255

https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextDouble-- >Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence. https://docs.oracle.com/javase/8/javafx/api/javafx/scene/paint/Color.html#color-double-double-double- > Creates an opaque sRGB color with the specified red, green and blue values in the range 0.0-1.0. Les valeurs sont entre 0 et 1 et pas entre 0 et 255
color = new Color(rand.nextDouble(), rand.nextDouble(), rand.nextDouble(), 1);
}
}