Commit 4445a809 authored by CRESCENCE Cassandre's avatar CRESCENCE Cassandre

Upload New File

parent 3f1ee451
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tictactoecodingame;
import java.util.ArrayList;
import java.util.Random;
/**
*
* @author cassa
*/
public class State extends Plateau {
Plateau plateau;
Joueur _joueur;
int visitCount;
double winScore;
Random rnd;
// constructor
State( Plateau plateau, Joueur _joueur, int visitCount, double winScore){
this.plateau = plateau;
this._joueur = _joueur;
this.visitCount = visitCount;
this.winScore = winScore;
}
// getters
public Plateau getPlateau(){
return plateau;
}
public Joueur getJoueur(){
return _joueur;
}
public int getVisitCount(){
return visitCount;
}
public double getWinScore(){
return winScore;
}
// setters
public void setPlateau(Plateau plateau){
this.plateau = plateau;
}
public void setJoueur(Joueur _joueur){
this._joueur = _joueur;
}
public void setVisitCount(int visitCount){
this.visitCount = visitCount;
}
public void setWinScore(double winScore){
this.winScore = winScore;
}
public ArrayList<Coup> getAllPossibleStates(){
//constructs a list of all possible states from current state
if( partieTerminee() == false){
return getListeCoups((State.this.getJoueur()));
}
}
public Coup randomPlay(Plateau _plateau, Joueur _joueur, boolean _ponder){
ArrayList<Coup> coups = _plateau.getListeCoups(_joueur);
return coups.get(rnd.nextInt( coups.size()));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment