
import java.util.*;

class Joueur {

  // nom du joueur
  String pseudo;

  // les 6 cartes a jouer
  Vector set = new Vector( 6 );

  // les atouts
  int    nbre_atouts = 0;
  Vector atouts = new Vector( 4 );

  // l'handicap
  boolean f_handicap = false;
  String handicap;

  // flag Stop/Roule
  boolean roule = false;

  // les cartes kilometriques collectionnees
  int    nbre_carte_km = 0;
  Vector kilometres = new Vector( 60 );

  // score du joueur
  int    score;

  // constructeur
  public Joueur( String nom ) {
    System.out.println("[Joueur::Joueur("+nom+")]");
    score = 0;
    pseudo = new String( nom );
    Stopper();
  }

  // Roule  /  Stop
  public boolean IsStopped( )  { return ( ! roule ); }
  public void    Stopper  ( )  { roule = false; }
  public void    Rouler   ( )  { roule = true;  }

  // methode pour jouer une carte
  public void JouerCarte( String nomCarte ) {
    System.out.println("[Joueur::Jouer("+nomCarte+")]");
    set.removeElement( nomCarte );
  }

  // accesseurs et modifiers
  // donne une nouvelle carte au joueur
  public void RecoitCarte( String nomCarte ) {
    System.out.println("[Joueur::RecoitCarte("+nomCarte +")]");
    set.addElement( nomCarte );
  }

  // ajout d'un atout dans sa liste des atouts
  public void NouvelAtout( String nomAtout ) {
    System.out.println("[Joueur::NouvelAtout("+nomAtout+")]");
    atouts.addElement( nomAtout );
  }
    


  // ajout d'une carte KM
  public void NouveauKM( String nomKM, int valKM ) {
    System.out.println("[Joueur::NouveauKM("+nomKM+")]");
    kilometres.addElement( nomKM );
    score += valKM;
  }

  // teste si le joueur est handicape
  public boolean IsHandicaped( ) {
    return f_handicap;
  }

  // Handicape le joueur avec la carte nomHandicap
  public void Handicape( String nomHandicap ) {
    System.out.println("[Joueur::Handicape("+nomHandicap+")]");
    handicap = nomHandicap;
    f_handicap = true;
    if ( nomHandicap.compareTo( "spdlimit" ) != 0 )
      roule = false; // ne peut plus rouler
  }

  // leve l'handicap courant
  public void LeveHandicap( ) {
    handicap = null;
    f_handicap = false;
    roule = true; // peut a nouveau rouler
  }

  // retourne le nom des cartes kilometriques collectionnees
  public String[] GetCollectionKM( ) {
    System.out.println("[Joueur::GetCollectionKM]");
    int size = kilometres.size();
    String s[] = new String[ size + 1 ];
    s[ size ] = null;
    kilometres.copyInto( s );
    return s;
  }

  // retourne le nom des atouts possedes par le joueur
  public String[] GetAtouts( ) {
    System.out.println("[Joueur::GetAtouts]");
    int size = atouts.size();
    String s[] = new String[ size + 1 ];
    atouts.copyInto( s );
    s[ size ] = null;
    return s;
  }


  // retourne le nom de la carte handicap ou null si pas d'handicap
  public String GetHandicap( ) {
    if ( IsHandicaped() )
      return handicap;
    return null;
  }


  // retourne le nom des cartes 'en main' du joueur
  public String[] GetCartes( ) {
    System.out.println("[Joueur::GetCartes]");
    int size = set.size();
    String s[] = new String[ size + 1 ];
    s[ size ] = null;
    set.copyInto( s );
    return s;
  }

  // retourne le score actuel du joueur
  public int GetScore( ) {
    System.out.println("[Joueur::GetScore( "+score+" )]");
    return score;
  }


  // retourne le nom/pseudo du joueur
  public String GetPseudo( ) { return pseudo; }

}

