Skip to content
Snippets Groups Projects
Select Git revision
  • fe63ef3b2266b317ebd771d628669854c879b20c
  • main default protected
2 results

RobinStrategy.java

Blame
  • Forked from TRAVERS Corentin / flooding-template
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    RobinStrategy.java 476 B
    package model;
    
    import javafx.scene.paint.Color;
    
    import java.util.List;
    
    public class RobinStrategy implements PlayStrategy {
        private final List<Color> availableColors;
        private int index = 0;
        public RobinStrategy(List<Color> availableColors) {
            this.availableColors = availableColors;
        }
    
    
    
    
        @Override
        public Color play(Cell startCell) {
            index = (index + 1) % availableColors.size();
            return availableColors.get(index);
        }
    
    
    }