|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectipdlx.Player
public class Player
base class for all players
| Field Summary | |
|---|---|
int |
gamesLost
|
int |
gamesPlayed
|
int |
gamesTied
|
int |
gamesWon
|
protected java.lang.String |
name
player's name |
protected Strategy |
strategy
player's strategy |
protected java.lang.Class |
strategyClass
|
| Constructor Summary | |
|---|---|
Player(Strategy strategy)
|
|
Player(Strategy strategy,
java.lang.String name)
|
|
| Method Summary | |
|---|---|
void |
clearMemory()
clears the memory of the player - sets his strategy to the initial state |
void |
clearResult()
|
double |
getMove()
returns move |
java.lang.String |
getName()
Returns the player name. |
double |
getResult()
returns result |
Strategy |
getStrategy()
|
protected Strategy |
getStrategy(boolean newInstance)
|
void |
reloadStrategy()
|
void |
setLastResult(double lastResult)
|
void |
setNumberOfOpponents(int nrOfOpponents)
|
void |
setOpponentMove(double opponentMove)
setter for opponentMove field |
void |
setOpponentsMoves(double[] opponentsMoves)
setter for opponentMove field |
void |
setStrategy(Strategy strategy)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Strategy strategy
protected java.lang.Class strategyClass
protected java.lang.String name
public int gamesPlayed
public int gamesWon
public int gamesLost
public int gamesTied
| Constructor Detail |
|---|
public Player(Strategy strategy)
strategy -
public Player(Strategy strategy,
java.lang.String name)
strategy - name - | Method Detail |
|---|
public java.lang.String getName()
public final void setStrategy(Strategy strategy)
public double getResult()
public void clearResult()
public void clearMemory()
public double getMove()
public void setOpponentMove(double opponentMove)
opponentMove - last move of the opponentpublic void setOpponentsMoves(double[] opponentsMoves)
opponentsMoves - last moves of the opponentspublic final void setNumberOfOpponents(int nrOfOpponents)
public void setLastResult(double lastResult)
public Strategy getStrategy()
public void reloadStrategy()
protected Strategy getStrategy(boolean newInstance)
public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||