Package wholaughs.player.user

Source Code of wholaughs.player.user.LunaticLucy

package wholaughs.player.user;

import wholaughs.game.GameSettings;
import wholaughs.game.GameState;
import wholaughs.game.GameStateClone;

public class LunaticLucy extends StupidSteward
{
  public LunaticLucy( int maxLevel )
  {     
    super( maxLevel );
  }
 
  public LunaticLucy()
  {
    super()
 
   
  protected void myFirstTurn( GameState state, GameSettings settings )
  {
    GameStateClone clone = state.clone();
    if( maxLevel > 0 )
    {
      int level = 1;
      for( Integer i : optionQuality.keySet() )
      {
        clone.insertStone( i, this );
        if( clone.isGameOver(settings, i) == this.getColour() )
        {
          optionQuality.get( i ).increaseQuality( factor / Math.pow( settings.getColumns(), level - 1 ) );
          break;
       
        if( level < maxLevel )
        {
          this.opponentTurn( clone, level + 1, i, settings );
        }
        clone.removeStone( i );
      }
    }
  }

  protected void myTurn( GameStateClone state, int level, int option, GameSettings settings  )
  {
    for( Integer i : state.columnsWithFreeCapacity() )
    {     
      state.insertStone( i, this );
      if( state.isGameOver(settings, i) == this.getColour() )
      {
        optionQuality.get( option ).increaseQuality( factor / Math.pow( settings.getColumns(), level - 1 ) );
     
      if( level < maxLevel )
      {
        this.opponentTurn( state, level + 1, option, settings );
      }
      state.removeStone( i );
    }   
  } 

  protected void opponentTurn( GameStateClone state, int level, int option, GameSettings settings  )
  {
      System.currentTimeMillis();
    for( Integer i : state.columnsWithFreeCapacity() )
    {     
      state.insertStone( i, opponentColor() );
      byte over = state.isGameOver(settings, i);
      if( over == opponentColor() )
      {
        optionQuality.get( option ).decreaseQuality( factor / Math.pow( settings.getColumns(), level - 1 ) );
      }     
      if( level < maxLevel )
      {
        this.myTurn( state, level + 1, option, settings );
      }
      state.removeStone( i );
    }   
  } 

}
TOP

Related Classes of wholaughs.player.user.LunaticLucy

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.