Skip to content
Snippets Groups Projects
Select Git revision
  • 982f8a8290f5ab87a490437f2e2a6482fa62cd24
  • main default protected
  • correction_video
  • going_further
  • ImprovedMouseInteraction
  • final2023
  • template
  • ModifGUI
8 results

CellularAutomatonSimulation.java

Blame
  • Forked from NAVES Guyslain / Game of life Template
    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;
        }
    
    }