package puissance4.controleur;

import puissance4.model.Grille;
import puissance4.model.Joueur;
import java.util.ArrayList;


public class Puissance4Controleur
{
    private Grille grilleCourant;
    private Joueur JoueurCourant;
    private Joueur victoire;
    private ArrayList<Joueur> ListeJoueur;

    public Puissance4Controleur() {
        this.grilleCourant = new Grille();
        this.JoueurCourant = null;
        this.victoire = null;
        this.ListeJoueur = new ArrayList<Joueur>();
    }

    public void startGame() {
        this.setJoueurCourant(this.ListeJoueur.get(0));
    }

    public Grille getGrilleCourant() {
        return this.grilleCourant;
    }

    private void setGrilleCourant(Grille grilleGame) {
        this.grilleCourant = grilleGame;
    }

    public Joueur getJoueurCourant() {
        return this.JoueurCourant;
    }

    private void setJoueurCourant(Joueur JoueurCourant) {
        this.JoueurCourant = JoueurCourant;
    }

    private ArrayList<Joueur> getListeJoueur() {
        return ListeJoueur;
    }

    public void addJoueur(Joueur joueur) {
        this.ListeJoueur.add(joueur);
    }

    public void JoueurSuivant() {
        if(this.JoueurCourant==this.ListeJoueur.get(0)){
            this.setJoueurCourant(this.ListeJoueur.get(1));
        }
        else{
            this.setJoueurCourant(this.ListeJoueur.get(0));
        }
    }

    private Joueur getVictoire() {
        return this.victoire;
    }

    private void setVictoire(Joueur joueurVictoire) {
        this.victoire = joueurVictoire;
    }

    public boolean peutJouer(int Ligne, int Colonne)
    {
        return true; //pas fini
    }
}