Class SGameController

java.lang.Object
  extended by SGameController
Direct Known Subclasses:
SGameFAController, SGameModelController, SGameQController

public class SGameController
extends java.lang.Object

This applet demonstrates a simple game. It isn't designed to be general or reusable.

Copyright (C) 2006 David Poole.

This program gives core of the simulation. The GUI is in SGameGUI.java. The environemnt code is at SGameEnv.java. The controller is at SGameController.java.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Field Summary
 boolean tracing
           
 
Method Summary
 void doreset(double initVal)
          resets the parameters this is overridden by learning controllers
 void dostep(int action)
          does one step.
 void doSteps(int count, double greedyProb)
          does count number of steps This is where you would put your controller
 double getAlpha()
           
 boolean getAlphaFixed()
           
 int getCounts(int xval, int yval, int action)
          This is not used in this controller, but is overridden by learning controllers.
 double getDiscount()
           
 SGameEnv getEnvironment()
           
 java.lang.String getTitle()
           
 double qvalue(int xval, int yval, int action)
          This is not used in this controller, but is overridden by learning controllers.
 void setAlpha(double newVal)
           
 void setAlphaFixed(boolean newVal)
           
 void setDiscount(double newDisc)
           
 double[] toDisplay()
          This can optionally return a set of real values to dosplay.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tracing

public boolean tracing
Method Detail

getTitle

public java.lang.String getTitle()

getEnvironment

public SGameEnv getEnvironment()

getDiscount

public double getDiscount()

setDiscount

public void setDiscount(double newDisc)

getAlphaFixed

public boolean getAlphaFixed()

setAlphaFixed

public void setAlphaFixed(boolean newVal)

getAlpha

public double getAlpha()

setAlpha

public void setAlpha(double newVal)

qvalue

public double qvalue(int xval,
                     int yval,
                     int action)
This is not used in this controller, but is overridden by learning controllers. It doesn't mean anything. The GUI uses it to display values and for the arrows. It is used if a controller wants to display Q values (or other values)


getCounts

public int getCounts(int xval,
                     int yval,
                     int action)
This is not used in this controller, but is overridden by learning controllers. It doesn't mean anything. The GUI uses it to display values and for the arrows. It is used if a controller wants to display Q values (or other values)


doreset

public void doreset(double initVal)
resets the parameters this is overridden by learning controllers

Parameters:
initVal - the initial value given by a box in the GUI

dostep

public void dostep(int action)
does one step. carries out the action in the environment. This may be a place to record what the agent has learned from its experience.

The actions are

Parameters:
action - the action that the agent does

doSteps

public void doSteps(int count,
                    double greedyProb)
does count number of steps This is where you would put your controller

Parameters:
count - the number of steps to do
greedyProb - the probability that is step is chosen greedily

toDisplay

public double[] toDisplay()
This can optionally return a set of real values to dosplay.