|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--fi.utu.cs.hockey.net.Client | +--fi.utu.cs.hockey.ai.AI
AI for a hockey player.
Nested Class Summary | |
static class |
AI.PlayerIterator
A class for iterating player positions. |
Field Summary |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Fields inherited from interface fi.utu.cs.hockey.net.Communication |
CENTER_SPOT, HEADING_ANGLE, NO_FACEOFF, OUR_ENDZONE_LEFT, OUR_ENDZONE_RIGHT, OUR_NEUTRAL_ZONE_LEFT, OUR_NEUTRAL_ZONE_RIGHT, THEIR_ENDZONE_LEFT, THEIR_ENDZONE_RIGHT, THEIR_NEUTRAL_ZONE_LEFT, THEIR_NEUTRAL_ZONE_RIGHT, X_COORDINATE, Y_COORDINATE |
Fields inherited from interface fi.utu.cs.hockey.Position |
CENTER, GOALKEEPER, LEFT_DEFENSE, LEFT_WING, RIGHT_DEFENSE, RIGHT_WING |
Constructor Summary | |
protected |
AI()
Creates a player AI |
protected |
AI(java.lang.String s,
java.lang.String t,
int n,
int p,
java.awt.Color h,
java.awt.Color j)
Creates a player AI with name s ,
team name t , number n ,
position p , helmet color h ,
and jersey color j . |
Method Summary | |
double |
headingTo(double[] p)
Returns the angle of heading to the point ( p[X_COORDINATE] , p[Y_COORDINATE] )
from the player's current location. |
double |
headingTo(double x,
double y)
Returns the angle of heading to the point ( x , y ) from the player's current
location. |
boolean |
isPuckWithinReach()
Returns true if the puck is within the
reach of the player. |
AI.PlayerIterator |
iteratorAll()
Returns an iterator for all player positions. |
AI.PlayerIterator |
iteratorDefense()
Returns an iterator for defense positions. |
AI.PlayerIterator |
iteratorForward()
Returns an iterator for forward positions. |
protected abstract void |
react()
Reacts to the game events. |
void |
run()
Calls repeatedly the react method. |
Methods inherited from class fi.utu.cs.hockey.net.Client |
brake, connect, dash, faceoff, finalize, getHelmetColor, getJerseyColor, getNumber, getPlayerName, getPosition, getTeamName, head, isFoul, isGameOver, isGameStopped, isGoal, isGoalieKeepingPuck, isIcing, isInHomeTeam, isInterferingGoalie, isJoined, isOffside, isPuckUnplayable, keepPuck, messages, player, puck, say, score, setHelmetColor, setJerseyColor, setNumber, setPlayerName, setPosition, setTeamName, shoot, time |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected AI()
protected AI(java.lang.String s, java.lang.String t, int n, int p, java.awt.Color h, java.awt.Color j)
s
,
team name t
, number n
,
position p
, helmet color h
,
and jersey color j
.
Method Detail |
public final void run()
react
method.
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected abstract void react()
public boolean isPuckWithinReach()
true
if the puck is within the
reach of the player.
public double headingTo(double x, double y)
x
, y
) from the player's current
location.
Communication.head(double)
public double headingTo(double[] p)
p[X_COORDINATE]
, p[Y_COORDINATE]
)
from the player's current location.
Communication.head(double)
,
Communication.X_COORDINATE
,
Communication.Y_COORDINATE
public AI.PlayerIterator iteratorAll()
public AI.PlayerIterator iteratorDefense()
public AI.PlayerIterator iteratorForward()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |