|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.nipax.hippo.pexeso.AI
cz.nipax.hippo.pexeso.AI_random
cz.nipax.hippo.pexeso.AI_forgetting
public class AI_forgetting
Implementation of forgetting inteligence. The AI remembers which positions were revealed, when and how many times. From this it decides (with some random) weather takes the correct position. It simulates "fault" by taking neighbour position instead of correct one.
Nested Class Summary | |
---|---|
(package private) class |
AI_forgetting.Piece
Store informations about one position in playground. |
Field Summary | |
---|---|
(package private) AI_forgetting.Piece[][] |
m_field
Representation of playground by field of AI_forgetting.Piece s. |
(package private) int |
m_lastID
Last revealed ID. |
(package private) int |
m_turn
Number of current turn. |
(package private) int |
m_x
width of playgorund |
(package private) int |
m_y
height of playground |
(package private) int |
my_turn
For determinig who is playing now. 0 == not our turn, 1 == our first card, 2 == our second card. |
Fields inherited from class cz.nipax.hippo.pexeso.AI |
---|
DEBUG, m_killed, m_pg, MOVESLEEP |
Constructor Summary | |
---|---|
AI_forgetting(Playground pg)
Simple constructor for variables init. |
Method Summary | |
---|---|
protected void |
first_random_move()
Random move in first turn. |
protected void |
first_turn()
Searches stored data and try to find two know pieces with same ID. |
java.lang.String |
getname()
Returns name of AI. |
void |
ivalidate(int x,
int y)
Invaliding position. |
void |
onturn()
Computes first move using first_turn() . |
void |
revealed(int x,
int y,
int ID)
Stores info about revealed card and makes second move if our turn. |
protected void |
second_random_move()
Random move in second turn. |
protected void |
second_turn()
Searches for buddy for just revealed pice. |
protected void |
thread_turn()
Computes one turn in separate thread. |
protected boolean |
try_turn(int x,
int y)
Delivers turn to Playground.wantturn(cz.nipax.hippo.pexeso.AI, int, int) . |
Methods inherited from class cz.nipax.hippo.pexeso.AI_random |
---|
random_move |
Methods inherited from class cz.nipax.hippo.pexeso.AI |
---|
kill, println, setSleep, userinput |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
int m_x
int m_y
int m_turn
revealed(int, int, int)
.
AI_forgetting.Piece[][] m_field
AI_forgetting.Piece
s.
int my_turn
int m_lastID
Constructor Detail |
---|
public AI_forgetting(Playground pg)
pg
- associated Playground
Method Detail |
---|
public java.lang.String getname()
getname
in class AI_random
public void onturn()
first_turn()
.
onturn
in class AI_random
protected void thread_turn()
protected boolean try_turn(int x, int y)
Playground.wantturn(cz.nipax.hippo.pexeso.AI, int, int)
. But before computes
some random and may modify x
and y
.
This is the method, where forgetting is simulated.
x
- coordinate of wanted movey
- coordinate of wanted moveprotected void first_turn()
protected void first_random_move()
AI_snc
.
protected void second_random_move()
AI_snc
.
protected void second_turn()
public void revealed(int x, int y, int ID)
revealed
in class AI
x
- coordinate of revealed cardy
- coordinate of revealed cardID
- ID of revealed cardpublic void ivalidate(int x, int y)
ivalidate
in class AI
x
- coordinate of invalid cardy
- coordinate of invalid card
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |