|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectjp.ac.fun.osawalab.tileworld.game.Unit
jp.ac.fun.osawalab.tileworld.game.Agent
public class Agent
Agent
は、Tileworldの世界で動くエージェントを表すクラスです。
フィールドの概要 | |
---|---|
static int |
MAX_SIZE
Tileworld全体での、エージェントの最大数です。 |
コンストラクタの概要 | |
---|---|
Agent(int x,
int y,
char agentID)
エージェントを生成し、その座標とIDをセットします。 |
|
Agent(Location location,
char agentID)
エージェントを生成し、その座標とIDをセットします。 |
メソッドの概要 | |
---|---|
void |
addScore(int score)
エージェントの得点を追加します。 |
char |
getAction()
エージェントの次の時刻に取る行動を取得します。 |
Location |
getDefaultLocation()
エージェントのデフォルトの座標を取得します。 |
String |
getID()
エージェントIDを取得します。 |
static char |
getNextAgentID()
次に生成されるエージェントに対する、適切なエージェントIDを返します。 |
Location |
getNextLocation()
エージェントの次の行動から計算される、次の座標を取得します。 |
Player |
getPlayer()
エージェントを制御しているプレイヤーを取得します。 |
int |
getScore()
エージェントの現在の得点を取得します。 |
static boolean |
isAgent(char symbol)
ある指定された記号が、エージェントを表すものであるかどうか調べます。 |
void |
move(char direction)
エージェントを指定された方向に移動します。 |
void |
move(Location nextLocation)
エージェントを指定された隣の座標に移動します。 |
void |
setAction(char action)
次の時刻に、エージェントがとる行動を設定します。 |
void |
setAction(String action)
次の時刻に、エージェントがとる行動を設定します。 |
void |
setPlayer(Player player)
エージェントを制御するプレイヤーを設定します。 |
void |
setScore(int score)
エージェントの得点を設定します。 |
char |
toChar()
Tileworldにおける、エージェントの表現(エージェントIDの1文字)を返します。 |
String |
toString()
エージェントの情報を文字列で取得します。 |
クラス jp.ac.fun.osawalab.tileworld.game.Unit から継承されたメソッド |
---|
canPush, create, create, getLocation, getNextLocation, getX, getY, isEnterable, setLocation, toCharArray |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
フィールドの詳細 |
---|
public static final int MAX_SIZE
a
からz
までで、
エージェントの最大数は、26であるとしています。
コンストラクタの詳細 |
---|
public Agent(int x, int y, char agentID)
x
- エージェントのx座標。y
- エージェントのy座標。agentID
- エージェントのID。public Agent(Location location, char agentID)
location
- エージェントの座標。agentID
- エージェントのID。メソッドの詳細 |
---|
public static char getNextAgentID()
a
からz
までで、
Tileworld内には、同じIDをもつエージェントは存在しないようにします。 このgetNextAgentID()
メソッドは、
a
からz
まで、アルファベット順に、 使われていないIDを一つ選んで返します。
public static boolean isAgent(char symbol)
symbol
- 調べたい記号
a
からz
までのアルファベット)
であれば、true
public void addScore(int score)
score
- 追加する得点。setScore(int)
,
getScore()
public char getAction()
setAction(String)
public Location getDefaultLocation()
public String getID()
public Location getNextLocation()
Unit.getNextLocation(char)
public Player getPlayer()
public int getScore()
addScore(int)
,
setScore(int)
public void move(char direction)
{'U', 'L', 'R', 'D', 'S'}
のいずれかである必要があります。
その方向に隣接するユニットが、Tile
である場合は、Tileを動かしながら、 移動することになります。
direction
- 移動する方向。move(Location)
,
#move(Unit)
public void move(Location nextLocation)
Tile
である場合は、Tileを動かしながら、
移動することになります。
nextLocation
- 目標とする座標。move(char)
,
#move(Unit)
public void setAction(char action)
{'U', 'L', 'R', 'D', 'S'}
のいずれかである必要があります。
action
- エージェントがとる行動setAction(String)
public void setAction(String action)
{"Up", "Left", "Right, "Down", "Stay"}
のいずれかである必要があります。
action
- エージェントがとる行動setAction(char)
public void setPlayer(Player player)
player
- エージェントを制御するプレイヤー。public void setScore(int score)
score
- 設定する得点。addScore(int)
,
getScore()
public char toChar()
Unit
内の toChar
a-z
のうちのどれか)。Unit.toChar()
public String toString()
Unit
内の toString
Unit.toChar()
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |