You need to sign in or sign up before continuing.
Select Git revision
Jenkinsfile
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
CyclicStrategy.java 551 B
package model;
import javafx.scene.paint.Color;
import java.util.List;
public class CyclicStrategy implements PlayStrategy{
private final List<Color> availableColors;
private int i=0;
public CyclicStrategy(List<Color> availableColors) {
this.availableColors = availableColors;
}
@Override
public Color play(Cell startCell) {
Color color = availableColors.get(i);
if (i<availableColors.size()-1) {
i += 1;
}
else {
i=0;
}
return color;
}
}