|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.nipax.hippo.pexeso.AI
public class AI
The basic class for all other AI classes. Defines basic interface for AI.
See Playground
for description of calls between AI and rest of the game.
Object of this class shouldn't be created od used since this class
doesn't implement any inteligence.
It is recommended to check m_killed
and m_pg.isEnd()
for end of AI's living.
Field Summary | |
---|---|
(package private) static boolean |
DEBUG
Determines weather println(java.lang.String) will write
anything to output. |
protected boolean |
m_killed
Determines state of AI. |
protected Playground |
m_pg
Playground where this AI is used. |
protected static int |
MOVESLEEP
Sleeptime between moves. |
Constructor Summary | |
---|---|
AI(Playground pg)
Simple constructior that only sets m_pg . |
Method Summary | |
---|---|
java.lang.String |
getname()
Gets name of AI. |
void |
ivalidate(int x,
int y)
Notify AI, that position is now invalid. |
void |
kill()
Notify AI, that it should end now and no longer disturb anyone. |
void |
onturn()
Notification from Playground that it is our turn. |
void |
println(java.lang.String s)
Inteligent printing message. |
void |
revealed(int x,
int y,
int ID)
Notification from Playground that it card in playground was revealed. |
static void |
setSleep(int time)
Set sleep time. |
void |
userinput(int x,
int y)
If user clicks on any card, this event is generated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static int MOVESLEEP
protected Playground m_pg
Playground
using Playground.wantturn(cz.nipax.hippo.pexeso.AI, int, int)
protected boolean m_killed
m_killed == true
the
AI should stop all computation and don't call any funcions
from m_pg
.
kill()
static final boolean DEBUG
println(java.lang.String)
will write
anything to output.
Constructor Detail |
---|
public AI(Playground pg)
m_pg
.
pg
- the Playground thi AI is playing onMethod Detail |
---|
public static void setSleep(int time)
time
- in milisecondspublic void println(java.lang.String s)
s
- the message to printpublic java.lang.String getname()
public void userinput(int x, int y)
x
- x coordinate of clicky
- y coortinate of clickpublic void onturn()
Playground
that it is our turn. Now the AI has two turns.
It is possible to make two moves directly from this function or wait for second
turn to function revealed(int, int, int)
. If the AI is successfull and guess two same
positions, this method is called again.
public void revealed(int x, int y, int ID)
Playground
that it card in playground was revealed.
AI may want to remember revealed cards somewere. This method is called everytime
any card is revealed.
x
- coordinate of cardy
- coordinate of cardID
- ID of cardpublic void ivalidate(int x, int y)
x
- coordinate of now invalid positiony
- coordinate of now invalid positionpublic void kill()
Playground
should take no more input Playground.wantturn(cz.nipax.hippo.pexeso.AI, int, int)
from killed AI.
This sets m_killed
to true
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |