Skip to content
Snippets Groups Projects
Select Git revision
  • 6a2fdffd1d7b57f57860f9ee50af9a3e87826cf7
  • main default protected
  • variant
3 results

SimulatorMain.class

Blame
  • Forked from COUETOUX Basile / FirefighterStarter
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ComputerPlayer.java 1.21 KiB
    package model;
    
    import javafx.scene.paint.Color;
    
    public class ComputerPlayer implements Player{
    
        private String name;
        private Cell cellStart;
        private PlayStrategy strategi;
        public ComputerPlayer(String name, Cell start){
            this.name=name;
            this.cellStart=start;
        }
        public ComputerPlayer(Cell start, PlayStrategy strategi){
            this.name="player";
            this.cellStart=start;
            this.strategi=strategi;
    
        }
        public ComputerPlayer(String name, Cell start,PlayStrategy strategi){
            this.name=name;
            this.cellStart=start;
            this.strategi= strategi;
        }
        @Override
        public boolean isHuman() {
            return false;
        }
    
        @Override
        public void setName(String name) {
            this.name = name;
        }
    
        @Override
        public String getName() {
            return this.name;
        }
    
        @Override
        public Cell getStartCell() {
            return this.cellStart;
        }
        public Color play(){
            return this.strategi.play(this.getStartCell());//  Color.RED;
        }
        public Color setStrategy(PlayStrategy strategy){
           this.strategi=strategy;
           return this.play();
      }
        public void setStartCell(Cell start){
            this.cellStart=start;
        }
    
    }