jais-checkins Mailing List for JAIS: Java Implemented Soccer
Status: Beta
Brought to you by:
maestrodd
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(58) |
Jun
(316) |
Jul
(154) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: <mae...@us...> - 2002-07-22 10:14:38
|
Update of /cvsroot/jais/jaisteam/src/jais
In directory usw-pr-cvs1:/tmp/cvs-serv3335/src/jais
Modified Files:
Jais.java
Log Message:
removed that thread, as it is unneeded, too
Index: Jais.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/Jais.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** Jais.java 15 Jul 2002 09:27:23 -0000 1.30
--- Jais.java 22 Jul 2002 10:14:33 -0000 1.31
***************
*** 23,27 ****
* @author Stephan Diederich
*/
! public class Jais extends Thread
{
static Logger logger=Logger.getLogger("jais");
--- 23,27 ----
* @author Stephan Diederich
*/
! public class Jais
{
static Logger logger=Logger.getLogger("jais");
***************
*** 56,60 ****
{
m_jaisTeam=f_jaisTeam;
- this.setName("Jais"+f_playerNumber);
m_teamName=f_teamName; //store our Teamname
m_playerNumber=f_playerNumber;
--- 56,59 ----
***************
*** 72,76 ****
m_eventList=new LinkedList();
m_singleMode=f_singleMode;
- startThread();
try
{
--- 71,74 ----
***************
*** 180,188 ****
public void onHear(HearEvent f_hearEvent)
{
! synchronized(m_eventList)
! {
! m_eventList.addLast(f_hearEvent);
! }
! wakeup();
}
--- 178,182 ----
public void onHear(HearEvent f_hearEvent)
{
! m_worldModel.updateAurealInfo(f_hearEvent);
}
***************
*** 193,201 ****
public void onSee(VisualEvent f_visualEvent)
{
! synchronized(m_eventList)
! {
! m_eventList.addLast(f_visualEvent);
! }
! wakeup();
}
--- 187,194 ----
public void onSee(VisualEvent f_visualEvent)
{
! m_worldModel.updateVisualInfo(f_visualEvent);
! m_ki.onNewData();
! if(m_visualizationEnabled)
! m_visualization.updateDisplay();
}
***************
*** 208,216 ****
//get our correct PlayerNumber first...
m_playerNumber=((InitInfo)f_initialEvent.getObjects().get(0)).m_uniformNumber;
! synchronized(m_eventList)
! {
! m_eventList.addLast(f_initialEvent);
! }
! wakeup();
}
--- 201,205 ----
//get our correct PlayerNumber first...
m_playerNumber=((InitInfo)f_initialEvent.getObjects().get(0)).m_uniformNumber;
! m_worldModel.updateInitInfo((InitialEvent) f_initialEvent);
}
***************
*** 221,229 ****
public synchronized void onSenseBody(SenseBodyEvent f_senseBodyEvent)
{
! synchronized(m_eventList)
! {
! m_eventList.addLast(f_senseBodyEvent);
! }
! wakeup();
}
--- 210,215 ----
public synchronized void onSenseBody(SenseBodyEvent f_senseBodyEvent)
{
! m_worldModel.updateSenseBodyInfo(f_senseBodyEvent);
! m_ki.onSenseBody();
}
***************
*** 267,325 ****
return;
}
- /* removed that, as it it only for hard debugging or playing ;)
- else if (l_tempString.equalsIgnoreCase("kick"))
- {
- try
- {
- m_communication.kick(Double.parseDouble(l_tokenizer.nextToken()),Double.parseDouble(l_tokenizer.nextToken()));
- }
- catch (xCommunication ex)
- {
- logger.fatal("Arg, could not send command to server!" + ex.getMessage());
- }
-
-
- return;
- }
- else if (l_tempString.equalsIgnoreCase("dash"))
- {
- try
- {
- m_communication.dash(Double.parseDouble(l_tokenizer.nextToken()));
- }
- catch (xCommunication ex)
- {
- logger.fatal("Arg, could not send command to server!" + ex.getMessage());
- }
-
-
- return;
- }
- else if (l_tempString.equalsIgnoreCase("turn"))
- {
- try
- {
- m_communication.turn(Double.parseDouble(l_tokenizer.nextToken()));
- }
- catch (xCommunication ex)
- {
- logger.fatal("Arg, could not send command to server!" + ex.getMessage());
- }
- return;
- }
- else if (l_tempString.equalsIgnoreCase("move"))
- {
- try
- {
- m_communication.move(Double.parseDouble(l_tokenizer.nextToken()),Double.parseDouble(l_tokenizer.nextToken()));
- }
- catch (xCommunication ex)
- {
- logger.fatal("Arg, could not send command to server!" + ex.getMessage());
- }
-
- return;
- }
- */
else if (l_tempString.equalsIgnoreCase("help"))
{
--- 253,256 ----
***************
*** 339,343 ****
public void quit()
{
- if (m_running) stopThread();
m_commandLineReading=false;
if (m_visualizationEnabled)
--- 270,273 ----
***************
*** 380,489 ****
m_visualizationEnabled=false;
}
-
- /**
- *
- */
- private synchronized void startThread()
- {
- m_thisThread=this;
- m_running=true;
- m_thisThread.start();
- }
-
- /**
- * @roseuid 3CE8B0FA022A
- */
- private synchronized void stopThread()
- {
- m_thisThread = null;
- m_running=false;
- notify();
- }
-
- /**
- * this methods says our thread that there's something to do
- */
- private synchronized void wakeup()
- {
- m_threadSuspended=false; // ok, he can run again if he wants to
- if (!m_threadSuspended) //check if we are suspended
- notify();
- }
-
- /**
- * @roseuid 3CE6898C03C1
- */
- public void run()
- {
- Thread l_thisThread = currentThread();
- boolean l_listIsEmpty=true;
- Event l_tempEvent;
- while(l_thisThread==m_thisThread)
- {
- synchronized (m_eventList)
- {
- l_listIsEmpty=m_eventList.isEmpty();
- }//synchronization of m_eventlist
- if (!l_listIsEmpty) //we have something to do
- {
- try
- {
- synchronized (m_eventList)
- {
- l_tempEvent=(Event)m_eventList.removeFirst();
- }
- if (l_tempEvent instanceof SenseBodyEvent)
- {
- m_worldModel.updateSenseBodyInfo((SenseBodyEvent) l_tempEvent);
- m_ki.onSenseBody();
- }
- else if (l_tempEvent instanceof VisualEvent)
- {
- m_worldModel.updateVisualInfo((VisualEvent) l_tempEvent);
- m_ki.onNewData();
- if(m_visualizationEnabled)
- m_visualization.updateDisplay();
- }
- else if (l_tempEvent instanceof HearEvent)
- {
- m_worldModel.updateAurealInfo((HearEvent) l_tempEvent);
- }
- else if (l_tempEvent instanceof InitialEvent)
- {
- m_worldModel.updateInitInfo((InitialEvent) l_tempEvent);
- }
- else
- logger.fatal("Cannot recognize Object in Eventlist!"+l_tempEvent.getClass().getName());
- }
- catch (Exception ex)
- {
- /* if(logger.getLevel().isGreaterOrEqual(Level.toPriority(Level.WARN_INT)))
- {
- logger.fatal("Got exception while dispatching events"+ex.getMessage());
- ex.printStackTrace();
- }
- */
- }
- }
- else
- {
- m_threadSuspended=true; //we want to suspend ourself after one run
- try
- {
- synchronized(this)
- {
- while (m_threadSuspended && l_thisThread==m_thisThread) //check again if we should sleep,
- {
- wait(); // this command lets our thread sleep until we wake him up
- }
- }
- }
- catch(java.lang.Exception ex)
- {
- logger.fatal("\t" + getName() + ": ARGG! Got an exception while sleeping ... "+ ex.getMessage());
- }
- }
- }//of while()
- }//of run()
private void readFromCommandline()
--- 310,313 ----
|
|
From: <mae...@us...> - 2002-07-22 10:06:55
|
Update of /cvsroot/jais/jaisteam/src/jais/player
In directory usw-pr-cvs1:/tmp/cvs-serv26259/src/jais/player
Modified Files:
KI.java
Log Message:
removed the thread in the KI. it isnt needed, as it has to work only
after a see event
Index: KI.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/KI.java,v
retrieving revision 1.81
retrieving revision 1.82
diff -C2 -d -r1.81 -r1.82
*** KI.java 15 Jul 2002 09:45:12 -0000 1.81
--- KI.java 22 Jul 2002 10:06:49 -0000 1.82
***************
*** 20,28 ****
! public class KI extends Thread implements Player
!
{
- Thread m_KIThread; // a reference to ourself
- boolean m_threadSuspended=false; //is our thread currently suspended
private static Logger logger=Logger.getLogger("jais.player");
--- 20,25 ----
! public class KI implements Player
{
private static Logger logger=Logger.getLogger("jais.player");
***************
*** 71,75 ****
public KI(WorldModel f_world, Communication f_myCom,int f_playerNumber)
{
- this.setName("KI"+f_playerNumber);
m_myWorld = f_world;
m_myState = new StateManager();
--- 68,71 ----
***************
*** 78,132 ****
/**
- * This method is started after a new visual info
- *
- * @roseuid 3CE80E3F03D8
- */
- public void run()
- {
- Thread l_thisThread = currentThread();
-
- while(l_thisThread==m_KIThread)
- {
- //ok, we were waked up, so theres new information avaiable. discard last actions and decide new
- m_actions.flush();
- //if (m_actions.listEmpty())
- {
- try
- {
- m_actions.InformVisualUpdateHappened();
- m_enemyTeam=m_myWorld.getEnemyPlayers();
- m_ownTeam=m_myWorld.getFriendlyPlayers();
- root(); //Start our tree in the root
- }
- catch (Exception ex)
- {
- logger.debug("Caught Execption from root in KI"+ex.getMessage());
- //ex.printStackTrace();
- logger.debug("Report this to jai...@li.... KI is still Working!");
- }
- }
- m_threadSuspended=true; //we want to suspend ourself after one run
- try
- {
- synchronized(this)
- {
- while (m_threadSuspended && l_thisThread==m_KIThread) //check again if we should sleep,
- {
- //logger.info("\t" + getName() + ": Going to wait now for something new");
- wait(); // this command lets our thread sleep until we wake him up
- }
- }
- }
- catch(java.lang.Exception ex)
- {
- //logger.info("\t" + getName() + ": ARGG! Got an exception while sleeping ... "+ ex.getMessage());
- }
- }//of while()
- //logger.info("\t" + getName() + ": i've left my while-loop. run() will stop immediatly
-
- }
-
-
- /**
* This "actionListener" waits for our sync-Event and passes it to the ActionManager
*/
--- 74,77 ----
***************
*** 1121,1126 ****
public void startKI()
{
- m_KIThread=this;
- m_KIThread.start();
m_actions.startActionPerformer();
}
--- 1066,1069 ----
***************
*** 1132,1138 ****
public synchronized void endTread()
{
- m_KIThread = null; //get a clean outcome
m_actions.stopActionPerformer();
- notify();
}
--- 1075,1079 ----
***************
*** 1143,1148 ****
public synchronized void onNewData()
{
! m_threadSuspended=false; // ok, he can run again if he wants to
! notify();
}
--- 1084,1092 ----
public synchronized void onNewData()
{
! m_actions.flush();
! m_actions.InformVisualUpdateHappened();
! m_enemyTeam=m_myWorld.getEnemyPlayers();
! m_ownTeam=m_myWorld.getFriendlyPlayers();
! root(); //Start our tree in the root
}
|
|
From: <mae...@us...> - 2002-07-15 10:29:06
|
Update of /cvsroot/jais/jaisteam/src/jais/player
In directory usw-pr-cvs1:/tmp/cvs-serv31503/src/jais/player
Modified Files:
ActionManager.java
Log Message:
ups... klitzekleine klammer falsch :(
Index: ActionManager.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/ActionManager.java,v
retrieving revision 1.63
retrieving revision 1.64
diff -C2 -d -r1.63 -r1.64
*** ActionManager.java 15 Jul 2002 10:22:18 -0000 1.63
--- ActionManager.java 15 Jul 2002 10:29:03 -0000 1.64
***************
*** 409,413 ****
else
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
// logger.fatal("normal dash sent(wo turn)"+Math.min(100,l_power));
addLastToActionList(new Action(DASH,Math.min(100,l_power/2),0));
--- 409,413 ----
else
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2-m_myWorld.getSenseBodyInfo().m_amountOfSpeed));
// logger.fatal("normal dash sent(wo turn)"+Math.min(100,l_power));
addLastToActionList(new Action(DASH,Math.min(100,l_power/2),0));
***************
*** 418,422 ****
if(!l_turnHappened)
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
--- 418,422 ----
if(!l_turnHappened)
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2-m_myWorld.getSenseBodyInfo().m_amountOfSpeed));
addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
***************
*** 425,429 ****
else
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
--- 425,429 ----
else
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2-m_myWorld.getSenseBodyInfo().m_amountOfSpeed));
addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
|
|
From: <mae...@us...> - 2002-07-15 10:22:22
|
Update of /cvsroot/jais/jaisteam/src/jais/player
In directory usw-pr-cvs1:/tmp/cvs-serv29742/src/jais/player
Modified Files:
ActionManager.java
Log Message:
ups... klitzekleine klammer falsch :(
Index: ActionManager.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/ActionManager.java,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -d -r1.62 -r1.63
*** ActionManager.java 15 Jul 2002 09:27:23 -0000 1.62
--- ActionManager.java 15 Jul 2002 10:22:18 -0000 1.63
***************
*** 395,399 ****
if (!l_turnHappened)
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position) - ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
// logger.fatal("narrow dash sent"+Math.min(100,l_power));
addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
--- 395,399 ----
if (!l_turnHappened)
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position) - ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2-m_myWorld.getSenseBodyInfo().m_amountOfSpeed));
// logger.fatal("narrow dash sent"+Math.min(100,l_power));
addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
***************
*** 403,407 ****
if(l_turnHappened)
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position) - ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
// logger.fatal("normal dash sent(with turn)"+Math.min(l_power,100));
addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
--- 403,407 ----
if(l_turnHappened)
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position) - ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2-m_myWorld.getSenseBodyInfo().m_amountOfSpeed));
// logger.fatal("normal dash sent(with turn)"+Math.min(l_power,100));
addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
|
|
From: <mae...@us...> - 2002-07-15 09:45:15
|
Update of /cvsroot/jais/jaisteam/src/jais/player
In directory usw-pr-cvs1:/tmp/cvs-serv20136
Modified Files:
KI.java
Log Message:
goalie is a bit better now
Index: KI.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/KI.java,v
retrieving revision 1.80
retrieving revision 1.81
diff -C2 -d -r1.80 -r1.81
*** KI.java 15 Jul 2002 09:27:23 -0000 1.80
--- KI.java 15 Jul 2002 09:45:12 -0000 1.81
***************
*** 645,652 ****
}
else
! if (nearestToTheBall())
! takeTheBall();
! else
! goBetweenBallGoalAndWatchIt(ServerConf.GOAL_WIDTH/2);
}
}
--- 645,669 ----
}
else
! {
! // if (nearestToTheBall())
! // takeTheBall();
! Coordinate l_coord = (m_myWorld.getBall().getAbsPositionOfNextRound()!=null) ? m_myWorld.getBall().getAbsPositionOfNextRound() : m_myWorld.getBall().getAbsPosition();
! if(l_coord.getX()<-41 && Math.abs(l_coord.getY())<14)
! {
! m_actions.runTo(MAXPOWER,l_coord,m_myWorld.getViewModeAsInt());
! }
! else
! {
! if(l_coord.sub(m_myWorld.getBall().getAbsPosition()).getX()>0 && l_coord.sub(m_myWorld.getBall().getAbsPosition()).getY()>0)
! {
! goBetweenBallGoalAndWatchIt(ServerConf.GOAL_WIDTH/2);
! }
! else
! if (nearestToTheBall())
! takeTheBall();
! else
! goBetweenBallGoalAndWatchIt(ServerConf.GOAL_WIDTH/2);
! }
! }
}
}
|
|
From: <mae...@us...> - 2002-07-15 09:44:43
|
Update of /cvsroot/jais/jaisteam/ext In directory usw-pr-cvs1:/tmp/cvs-serv18895 Added Files: 1.wav Log Message: nice...really nice --- NEW FILE: 1.wav --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/jais/jaisteam/src/jais/communication
In directory usw-pr-cvs1:/tmp/cvs-serv15661/communication
Modified Files:
VisualEvent.java SenseBodyEvent.java InitialEvent.java
HearEvent.java Communication.java
Log Message:
many many cahnges ;) version 1.01 is ready !
Index: VisualEvent.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/VisualEvent.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** VisualEvent.java 8 Jul 2002 07:17:57 -0000 1.15
--- VisualEvent.java 15 Jul 2002 09:27:23 -0000 1.16
***************
*** 16,20 ****
public class VisualEvent extends Event
{
! private static Logger logger=Logger.getLogger("jais.communication"); //get our logger
// names and types of the different obj who can appear in the See message
public static final String[] OBJ_NAME_STRINGS = {"p","b","g","f","l","B","F","G","P"};
--- 16,20 ----
public class VisualEvent extends Event
{
! // private static Logger logger=Logger.getLogger("jais.communication"); //get our logger
// names and types of the different obj who can appear in the See message
public static final String[] OBJ_NAME_STRINGS = {"p","b","g","f","l","B","F","G","P"};
***************
*** 474,478 ****
break;
default:
! logger.info("Could not determine type of object");
} // end of switch object name
} // end of while
--- 474,478 ----
break;
default:
! // logger.info("Could not determine type of object");
} // end of switch object name
} // end of while
***************
*** 481,486 ****
catch (Exception e)
{
! logger.info("Error parsing see message :"+e.getMessage());
! logger.debug("Message to parse was discarded:"+m_message);
return;
}
--- 481,486 ----
catch (Exception e)
{
! // logger.info("Error parsing see message :"+e.getMessage());
! // logger.debug("Message to parse was discarded:"+m_message);
return;
}
Index: SenseBodyEvent.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/SenseBodyEvent.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** SenseBodyEvent.java 13 Jul 2002 20:29:24 -0000 1.10
--- SenseBodyEvent.java 15 Jul 2002 09:27:23 -0000 1.11
***************
*** 15,19 ****
public class SenseBodyEvent extends Event
{
! private static Logger logger=Logger.getLogger("jais.communication"); //get our logger
/**
--- 15,19 ----
public class SenseBodyEvent extends Event
{
! // private static Logger logger=Logger.getLogger("jais.communication"); //get our logger
/**
***************
*** 92,96 ****
catch(Exception e)
{
! logger.info("Error parsing see message :"+e.getMessage());
}
}
--- 92,96 ----
catch(Exception e)
{
! // logger.info("Error parsing see message :"+e.getMessage());
}
}
Index: InitialEvent.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/InitialEvent.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** InitialEvent.java 8 Jul 2002 00:16:16 -0000 1.11
--- InitialEvent.java 15 Jul 2002 09:27:23 -0000 1.12
***************
*** 17,21 ****
{
private InitInfo m_initInfo;
! private static Logger logger=Logger.getLogger("jais.communication"); //get our logger
private StringTokenizer m_tokenizer;
public static final String[] INITIAL_TYPE_STRINGS = {
--- 17,21 ----
{
private InitInfo m_initInfo;
! // private static Logger logger=Logger.getLogger("jais.communication"); //get our logger
private StringTokenizer m_tokenizer;
public static final String[] INITIAL_TYPE_STRINGS = {
***************
*** 306,315 ****
break;
default:
! logger.info("Could not determine type of object");
}
} // end of try
catch(Exception e)
{
! logger.info("Error parsing see message :"+e.getMessage());
}
}
--- 306,315 ----
break;
default:
! // logger.info("Could not determine type of object");
}
} // end of try
catch(Exception e)
{
! // logger.info("Error parsing see message :"+e.getMessage());
}
}
Index: HearEvent.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/HearEvent.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** HearEvent.java 8 Jul 2002 07:17:57 -0000 1.14
--- HearEvent.java 15 Jul 2002 09:27:23 -0000 1.15
***************
*** 15,19 ****
public class HearEvent extends Event
{
! private static Logger logger=Logger.getLogger("jais.communication"); //get our logger
/**
--- 15,19 ----
public class HearEvent extends Event
{
! // private static Logger logger=Logger.getLogger("jais.communication"); //get our logger
/**
***************
*** 46,50 ****
l_tokenizer.nextToken(); // first token 'hear'
l_hear_info.m_time = Integer.parseInt(l_tokenizer.nextToken()); // then element time
-
//then finding out who sends the message:referee,online_coach_right,online_coach_left,self
l_token = l_tokenizer.nextToken();
--- 46,49 ----
***************
*** 57,61 ****
}
l_hear_info.m_sender = l_sender; // set the sender
-
// when the sender is determined, one of the 4 following sender-parsers is called
switch(l_sender)
--- 56,59 ----
***************
*** 104,108 ****
catch (Exception e)
{
! logger.info("Error parsing hear information, while parsing String:" + m_message + " exception :" +e.getMessage());
}
}
--- 102,106 ----
catch (Exception e)
{
! // logger.info("Error parsing hear information, while parsing String:" + m_message + " exception :" +e.getMessage());
}
}
Index: Communication.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/Communication.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** Communication.java 14 Jul 2002 14:01:23 -0000 1.31
--- Communication.java 15 Jul 2002 09:27:23 -0000 1.32
***************
*** 60,66 ****
{
this.setName("Communication"+f_playerNumber);
! logger.info("Succ. instan. Commun.!?");
! logger.info("1 Server name is: "+f_serverName);
! logger.info("2 Server port is: "+f_serverPort);
m_jais = f_jais;
m_serverName = f_serverName;
--- 60,66 ----
{
this.setName("Communication"+f_playerNumber);
! //logger.info("Succ. instan. Commun.!?");
! //logger.info("1 Server name is: "+f_serverName);
! //logger.info("2 Server port is: "+f_serverPort);
m_jais = f_jais;
m_serverName = f_serverName;
***************
*** 74,78 ****
try
{
! logger.info("Bind socket to a port...");
// set datagram socket and bind it to a port
this.m_socket = new DatagramSocket();
--- 74,78 ----
try
{
! //logger.info("Bind socket to a port...");
// set datagram socket and bind it to a port
this.m_socket = new DatagramSocket();
***************
*** 82,98 ****
this.m_serverPort = m_serverPort;
m_socket.setSoTimeout(m_timeoutAfter);
! logger.info("2 Server port: "+ this.m_serverPort);
! logger.info("The resolved server address is: "+this.m_serverAddress);
! logger.info("Binded socket to a port!");
}
catch (SocketException se)
{
! logger.info("Could not bind socket to a port! "+se.getMessage());
throw(new xCommunication("Could not bind socket to a port!"));
}
catch (UnknownHostException uhe)
{
! logger.info("The choosen host is not reachable!"+uhe.getMessage()
! +" serverport: "+this.m_serverPort);
throw(new xCommunication("The choosen host is not reachable: '"
+this.m_serverAddress+"'"));
--- 82,98 ----
this.m_serverPort = m_serverPort;
m_socket.setSoTimeout(m_timeoutAfter);
! //logger.info("2 Server port: "+ this.m_serverPort);
! //logger.info("The resolved server address is: "+this.m_serverAddress);
! //logger.info("Binded socket to a port!");
}
catch (SocketException se)
{
! //logger.info("Could not bind socket to a port! "+se.getMessage());
throw(new xCommunication("Could not bind socket to a port!"));
}
catch (UnknownHostException uhe)
{
! //logger.info("The choosen host is not reachable!"+uhe.getMessage()
! // +" serverport: "+this.m_serverPort);
throw(new xCommunication("The choosen host is not reachable: '"
+this.m_serverAddress+"'"));
***************
*** 124,131 ****
l_goalieSpaceHolder = "(goalie)";
}
! logger.info("Connecting to server...");
sendMessageToServer("(init " + m_teamName + " (version 7.0) "
+ l_goalieSpaceHolder + ")");
! logger.info("Waiting for data from server...");
// to prevent a little server/client 'crash' while init. a whole team
receiveDataFromServer();
--- 124,131 ----
l_goalieSpaceHolder = "(goalie)";
}
! //logger.info("Connecting to server...");
sendMessageToServer("(init " + m_teamName + " (version 7.0) "
+ l_goalieSpaceHolder + ")");
! //logger.info("Waiting for data from server...");
// to prevent a little server/client 'crash' while init. a whole team
receiveDataFromServer();
***************
*** 139,144 ****
public void reconnectToServer(int f_playerNumber) throws xCommunication
{
! logger.info("Starting to reconnect to server...");
! logger.info("Reconnecting to server...");
sendMessageToServer("(reconnect " + m_teamName + " " + f_playerNumber + ")");
}
--- 139,144 ----
public void reconnectToServer(int f_playerNumber) throws xCommunication
{
! //logger.info("Starting to reconnect to server...");
! //logger.info("Reconnecting to server...");
sendMessageToServer("(reconnect " + m_teamName + " " + f_playerNumber + ")");
}
***************
*** 156,160 ****
if(m_connectedToServer==true)
{
! logger.info("Disconnecting from server... Bye from Commu.");
//from now it is shure: we want to disconnect
--- 156,160 ----
if(m_connectedToServer==true)
{
! //logger.info("Disconnecting from server... Bye from Commu.");
//from now it is shure: we want to disconnect
***************
*** 169,174 ****
catch (Exception ex)
{
! logger.info("Could not min. socket time out for disconnection: "
! +ex.getMessage());
}
--- 169,174 ----
catch (Exception ex)
{
! //logger.info("Could not min. socket time out for disconnection: "
! // +ex.getMessage());
}
***************
*** 179,184 ****
else
{
! logger.info("Bye from Communication: Jais was not connected to"
! +" the server (no server data received/not regularly connected)!");
}
//close the opended socket
--- 179,184 ----
else
{
! //logger.info("Bye from Communication: Jais was not connected to"
! //+" the server (no server data received/not regularly connected)!");
}
//close the opended socket
***************
*** 208,217 ****
try
{
! //logger.fatal("Server Message is: "+m_stuffToSendToServer + " time:" +System.currentTimeMillis() );
// init buffer
byte[] l_buffer = new byte[1024];
// m_stuffToSendToServer -> byte field
l_buffer = m_stuffToSendToServer.getBytes();
! logger.info("3 Server port is: "+m_serverPort);
// creat new datagram packet
DatagramPacket l_packet = new DatagramPacket(l_buffer,
--- 208,217 ----
try
{
! // logger.fatal("Server Message is: "+m_stuffToSendToServer + " time:" +System.currentTimeMillis() );
// init buffer
byte[] l_buffer = new byte[1024];
// m_stuffToSendToServer -> byte field
l_buffer = m_stuffToSendToServer.getBytes();
! //logger.info("3 Server port is: "+m_serverPort);
// creat new datagram packet
DatagramPacket l_packet = new DatagramPacket(l_buffer,
***************
*** 224,231 ****
catch (IOException ioe)
{
! logger.info("Error while reading from socket: "+ioe.getMessage());
throw(new xCommunication("(socket error) Could not send data to server!"));
}
! logger.info("...Succeeded to send data to server!");
}
--- 224,231 ----
catch (IOException ioe)
{
! //logger.info("Error while reading from socket: "+ioe.getMessage());
throw(new xCommunication("(socket error) Could not send data to server!"));
}
! //logger.info("...Succeeded to send data to server!");
}
***************
*** 283,287 ****
catch (xCommunication xCom)
{
! logger.info("Could not send catchBall action! "+xCom.getMessage());
throw(new xCommunication("Could not send catchBall action!"));
}
--- 283,287 ----
catch (xCommunication xCom)
{
! //logger.info("Could not send catchBall action! "+xCom.getMessage());
throw(new xCommunication("Could not send catchBall action!"));
}
***************
*** 308,312 ****
catch (xCommunication xCom)
{
! logger.info("Could not send dash action! "+xCom.getMessage());
throw(new xCommunication("Could not send dash action!"));
}
--- 308,312 ----
catch (xCommunication xCom)
{
! //logger.info("Could not send dash action! "+xCom.getMessage());
throw(new xCommunication("Could not send dash action!"));
}
***************
*** 333,337 ****
catch (xCommunication xCom)
{
! logger.info("Could not send kick action! "+xCom.getMessage());
throw(new xCommunication("Could not send kick action!"));
}
--- 333,337 ----
catch (xCommunication xCom)
{
! //logger.info("Could not send kick action! "+xCom.getMessage());
throw(new xCommunication("Could not send kick action!"));
}
***************
*** 357,361 ****
catch (xCommunication xCom)
{
! logger.info("Could not send turn neck action! "+xCom.getMessage());
throw(new xCommunication("Could not send turn neck action!"));
}
--- 357,361 ----
catch (xCommunication xCom)
{
! //logger.info("Could not send turn neck action! "+xCom.getMessage());
throw(new xCommunication("Could not send turn neck action!"));
}
***************
*** 381,385 ****
catch (xCommunication xCom)
{
! logger.info("Could not send move action! "+xCom.getMessage());
throw(new xCommunication("Could not send move action!"));
}
--- 381,385 ----
catch (xCommunication xCom)
{
! //logger.info("Could not send move action! "+xCom.getMessage());
throw(new xCommunication("Could not send move action!"));
}
***************
*** 404,408 ****
catch (xCommunication xCom)
{
! logger.info("Could not send turn action! "+xCom.getMessage());
throw(new xCommunication("Could not send turn action!"));
}
--- 404,408 ----
catch (xCommunication xCom)
{
! //logger.info("Could not send turn action! "+xCom.getMessage());
throw(new xCommunication("Could not send turn action!"));
}
***************
*** 427,431 ****
catch (xCommunication xCom)
{
! logger.info("Could not send say action! "+xCom.getMessage());
throw(new xCommunication("Could not send say action!"));
}
--- 427,431 ----
catch (xCommunication xCom)
{
! //logger.info("Could not send say action! "+xCom.getMessage());
throw(new xCommunication("Could not send say action!"));
}
***************
*** 454,458 ****
catch (xCommunication xCom)
{
! logger.info("Could not send change view action! "+xCom.getMessage());
throw(new xCommunication("Could not send change view action!"));
}
--- 454,458 ----
catch (xCommunication xCom)
{
! //logger.info("Could not send change view action! "+xCom.getMessage());
throw(new xCommunication("Could not send change view action!"));
}
***************
*** 496,500 ****
{
//info for the first time:
! logger.info("Connected to server...(received something)");
//for the first time: set m_connectedToServer=true
--- 496,500 ----
{
//info for the first time:
! //logger.info("Connected to server...(received something)");
//for the first time: set m_connectedToServer=true
***************
*** 503,508 ****
}
! logger.info("Received server Mess.: '"+m_receivedMessageFromServer+"'");
! logger.info("Lenght of server Message: '"+m_receivedMessageFromServer.length()+"'");
m_timeoutCounter=5; //reset our timeoutcounter if we receive a message
//check for incoming message type
--- 503,508 ----
}
! //logger.info("Received server Mess.: '"+m_receivedMessageFromServer+"'");
! //logger.info("Lenght of server Message: '"+m_receivedMessageFromServer.length()+"'");
m_timeoutCounter=5; //reset our timeoutcounter if we receive a message
//check for incoming message type
***************
*** 516,522 ****
if(m_disconnectCommand==false)
{
! logger.info("Timeout while reading from socket: "+ioe.getMessage());
! logger.info("Jais tried "+m_timeoutAfter+"ms to receive data "+
! "from server...exiting communication!");
if(m_connectedToServer)
{
--- 516,522 ----
if(m_disconnectCommand==false)
{
! //logger.info("Timeout while reading from socket: "+ioe.getMessage());
! //logger.info("Jais tried "+m_timeoutAfter+"ms to receive data "+
! //"from server...exiting communication!");
if(m_connectedToServer)
{
***************
*** 547,551 ****
if (m_receivedMessageFromServer.startsWith("(sense"))
{
! // logger.fatal("Sense_Body event detected..." + System.currentTimeMillis()+"*******************");
SenseBodyEvent newSenseBodyEvent = new SenseBodyEvent(m_receivedMessageFromServer);
m_jais.onSenseBody(newSenseBodyEvent);
--- 547,551 ----
if (m_receivedMessageFromServer.startsWith("(sense"))
{
! // //logger.fatal("Sense_Body event detected..." + System.currentTimeMillis()+"*******************");
SenseBodyEvent newSenseBodyEvent = new SenseBodyEvent(m_receivedMessageFromServer);
m_jais.onSenseBody(newSenseBodyEvent);
***************
*** 554,558 ****
else if (m_receivedMessageFromServer.startsWith("(see"))
{
! // logger.fatal("Visual event detected..."+System.currentTimeMillis()+"*******************");
VisualEvent newVisualEvent = new VisualEvent(m_receivedMessageFromServer);
m_jais.onSee(newVisualEvent);
--- 554,558 ----
else if (m_receivedMessageFromServer.startsWith("(see"))
{
! // //logger.fatal("Visual event detected..."+System.currentTimeMillis()+"*******************");
VisualEvent newVisualEvent = new VisualEvent(m_receivedMessageFromServer);
m_jais.onSee(newVisualEvent);
***************
*** 561,565 ****
else if (m_receivedMessageFromServer.startsWith("(hear"))
{
! logger.info("Hear event detected...");
HearEvent newHearEvent = new HearEvent(m_receivedMessageFromServer);
m_jais.onHear(newHearEvent);
--- 561,565 ----
else if (m_receivedMessageFromServer.startsWith("(hear"))
{
! //logger.info("Hear event detected...");
HearEvent newHearEvent = new HearEvent(m_receivedMessageFromServer);
m_jais.onHear(newHearEvent);
***************
*** 568,572 ****
else if (m_receivedMessageFromServer.startsWith("(init"))
{
! logger.info("Init event detected...");
InitialEvent newInitialEvent = new InitialEvent(m_receivedMessageFromServer);
m_jais.onInitialEvent(newInitialEvent);
--- 568,572 ----
else if (m_receivedMessageFromServer.startsWith("(init"))
{
! //logger.info("Init event detected...");
InitialEvent newInitialEvent = new InitialEvent(m_receivedMessageFromServer);
m_jais.onInitialEvent(newInitialEvent);
***************
*** 575,579 ****
else if (m_receivedMessageFromServer.startsWith("(server"))
{
! logger.info("Detected server params...");
InitialEvent newInitialEvent = new InitialEvent(m_receivedMessageFromServer);
}
--- 575,579 ----
else if (m_receivedMessageFromServer.startsWith("(server"))
{
! //logger.info("Detected server params...");
InitialEvent newInitialEvent = new InitialEvent(m_receivedMessageFromServer);
}
***************
*** 581,585 ****
else if (m_receivedMessageFromServer.startsWith("(player") )
{
! logger.debug("Detected player params...");
InitialEvent newInitialEvent = new InitialEvent(m_receivedMessageFromServer);
}
--- 581,585 ----
else if (m_receivedMessageFromServer.startsWith("(player") )
{
! //logger.debug("Detected player params...");
InitialEvent newInitialEvent = new InitialEvent(m_receivedMessageFromServer);
}
***************
*** 588,595 ****
else if (m_receivedMessageFromServer.startsWith("(error unknown"))
{
! logger.warn("Error message from server side as reaction on "
! +"client control command: '"+m_receivedMessageFromServer+"'!");
! logger.warn("The last recently sent message to server from Jais has been: "
! +m_stuffToSendToServer);
}
// check if new message has been an error mess. as reaction on
--- 588,595 ----
else if (m_receivedMessageFromServer.startsWith("(error unknown"))
{
! //logger.warn("Error message from server side as reaction on "
! // +"client control command: '"+m_receivedMessageFromServer+"'!");
! //logger.warn("The last recently sent message to server from Jais has been: "
! // +m_stuffToSendToServer);
}
// check if new message has been an error mess. as reaction on
***************
*** 597,604 ****
else if (m_receivedMessageFromServer.startsWith("(error illegal"))
{
! logger.warn("Error message from server side as reaction on "
! +"client control command: '"+m_receivedMessageFromServer+"'!");
! logger.warn("The last recently sent message to server from Jais has been: "
! +m_stuffToSendToServer);
}
// check if new message has been an error mess. as reaction on
--- 597,604 ----
else if (m_receivedMessageFromServer.startsWith("(error illegal"))
{
! //logger.warn("Error message from server side as reaction on "
! // +"client control command: '"+m_receivedMessageFromServer+"'!");
! //logger.warn("The last recently sent message to server from Jais has been: "
! // +m_stuffToSendToServer);
}
// check if new message has been an error mess. as reaction on
***************
*** 606,615 ****
else if (m_receivedMessageFromServer.startsWith("(error no_more_team_or_player_or_goalie"))
{
! logger.fatal("Error message from server side as reaction on "
! +"init command (because e.g. team name given away: '"
! +m_receivedMessageFromServer+"'!");
! logger.fatal("The last recently sent message to server from Jais has been: "
! +m_stuffToSendToServer);
//received something but haven't been regularly connected
--- 606,615 ----
else if (m_receivedMessageFromServer.startsWith("(error no_more_team_or_player_or_goalie"))
{
! //logger.fatal("Error message from server side as reaction on "
! // +"init command (because e.g. team name given away: '"
! // +m_receivedMessageFromServer+"'!");
! //logger.fatal("The last recently sent message to server from Jais has been: "
! // +m_stuffToSendToServer);
//received something but haven't been regularly connected
***************
*** 623,630 ****
else if (m_receivedMessageFromServer.startsWith("(error no_more_team_or_player"))
{
! logger.fatal("Error message from server side as reaction on "
! +"reconnect command: '"+m_receivedMessageFromServer+"'!");
! logger.fatal("The last recently sent message to server from Jais has been: "
! +m_stuffToSendToServer);
//received something but haven't been regularly connected
--- 623,630 ----
else if (m_receivedMessageFromServer.startsWith("(error no_more_team_or_player"))
{
! //logger.fatal("Error message from server side as reaction on "
! // +"reconnect command: '"+m_receivedMessageFromServer+"'!");
! //logger.fatal("The last recently sent message to server from Jais has been: "
! // +m_stuffToSendToServer);
//received something but haven't been regularly connected
***************
*** 638,645 ****
else if (m_receivedMessageFromServer.startsWith("(error reconnect"))
{
! logger.fatal("Error message from server side as reaction on "
! +"reconnect command: '"+m_receivedMessageFromServer+"'!");
! logger.fatal("The last recently sent message to server from Jais has been: "
! +m_stuffToSendToServer);
//received something but haven't been regularly connected
--- 638,645 ----
else if (m_receivedMessageFromServer.startsWith("(error reconnect"))
{
! //logger.fatal("Error message from server side as reaction on "
! // +"reconnect command: '"+m_receivedMessageFromServer+"'!");
! //logger.fatal("The last recently sent message to server from Jais has been: "
! // +m_stuffToSendToServer);
//received something but haven't been regularly connected
***************
*** 652,659 ****
else
{
! logger.info("Unknown server message received! ...but going on. Message was: "
! + m_receivedMessageFromServer);
! logger.info("The last recently sent message to server from Jais has been: "
! +m_stuffToSendToServer);
}
}
--- 652,659 ----
else
{
! //logger.info("Unknown server message received! ...but going on. Message was: "
! // + m_receivedMessageFromServer);
! //logger.info("The last recently sent message to server from Jais has been: "
! // +m_stuffToSendToServer);
}
}
***************
*** 684,688 ****
public void finalize()
{
! logger.info("Ok, closing my socket!");
}
}
--- 684,688 ----
public void finalize()
{
! //logger.info("Ok, closing my socket!");
}
}
|
|
From: <mae...@us...> - 2002-07-15 09:27:27
|
Update of /cvsroot/jais/jaisteam/src/jais
In directory usw-pr-cvs1:/tmp/cvs-serv15661
Modified Files:
Jais.java
Log Message:
many many cahnges ;) version 1.01 is ready !
Index: Jais.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/Jais.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** Jais.java 14 Jul 2002 22:56:40 -0000 1.29
--- Jais.java 15 Jul 2002 09:27:23 -0000 1.30
***************
*** 458,466 ****
catch (Exception ex)
{
! if(logger.getLevel().isGreaterOrEqual(Level.toPriority(Level.WARN_INT)))
{
logger.fatal("Got exception while dispatching events"+ex.getMessage());
ex.printStackTrace();
}
}
}
--- 458,467 ----
catch (Exception ex)
{
! /* if(logger.getLevel().isGreaterOrEqual(Level.toPriority(Level.WARN_INT)))
{
logger.fatal("Got exception while dispatching events"+ex.getMessage());
ex.printStackTrace();
}
+ */
}
}
|
|
From: <mae...@us...> - 2002-07-15 09:27:26
|
Update of /cvsroot/jais/jaisteam/src/jais/player
In directory usw-pr-cvs1:/tmp/cvs-serv15661/player
Modified Files:
KI.java ActionManager.java
Log Message:
many many cahnges ;) version 1.01 is ready !
Index: KI.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/KI.java,v
retrieving revision 1.79
retrieving revision 1.80
diff -C2 -d -r1.79 -r1.80
*** KI.java 14 Jul 2002 22:56:40 -0000 1.79
--- KI.java 15 Jul 2002 09:27:23 -0000 1.80
***************
*** 43,54 ****
private final double MAXPOWER = 100; //ServerConf.MAXPOWER;
! private final int HOMERANGE_R = 5;
private final Coordinate MY_GOAL_POS = new Coordinate(-52.5, 0);
private final Coordinate ENEMY_GOAL_POS = new Coordinate(52.5, 0);
! private final int MAX_GOAL_KICK_DISTANCE = 25;
private final int MIN_DISTANCE_FOR_DRIBBEL = 10;
private final int MAX_PASS_DISTANCE =30;
! private final int MAX_LOOKING_FORWARD_TIME = 20;
!
private final int MAX_ANGLE_FOR_GOAL_KICK = 75;
private final int FREE_ANGLE_FOR_GOAL_KICK = 5;
--- 43,53 ----
private final double MAXPOWER = 100; //ServerConf.MAXPOWER;
! private final int HOMERANGE_R = 6;
private final Coordinate MY_GOAL_POS = new Coordinate(-52.5, 0);
private final Coordinate ENEMY_GOAL_POS = new Coordinate(52.5, 0);
! private final int MAX_GOAL_KICK_DISTANCE = 30;
private final int MIN_DISTANCE_FOR_DRIBBEL = 10;
private final int MAX_PASS_DISTANCE =30;
! private final int MAX_LOOKING_FORWARD_TIME = 10;
private final int MAX_ANGLE_FOR_GOAL_KICK = 75;
private final int FREE_ANGLE_FOR_GOAL_KICK = 5;
***************
*** 91,106 ****
//ok, we were waked up, so theres new information avaiable. discard last actions and decide new
m_actions.flush();
! try
! {
! m_actions.InformVisualUpdateHappened();
! m_enemyTeam=m_myWorld.getEnemyPlayers();
! m_ownTeam=m_myWorld.getFriendlyPlayers();
! root(); //Start our tree in the root
! }
! catch (Exception ex)
{
! logger.debug("Caught Execption from root in KI"+ex.getMessage());
! ex.printStackTrace();
! logger.debug("Report this to jai...@li.... KI is still Working!");
}
m_threadSuspended=true; //we want to suspend ourself after one run
--- 90,108 ----
//ok, we were waked up, so theres new information avaiable. discard last actions and decide new
m_actions.flush();
! //if (m_actions.listEmpty())
{
! try
! {
! m_actions.InformVisualUpdateHappened();
! m_enemyTeam=m_myWorld.getEnemyPlayers();
! m_ownTeam=m_myWorld.getFriendlyPlayers();
! root(); //Start our tree in the root
! }
! catch (Exception ex)
! {
! logger.debug("Caught Execption from root in KI"+ex.getMessage());
! //ex.printStackTrace();
! logger.debug("Report this to jai...@li.... KI is still Working!");
! }
}
m_threadSuspended=true; //we want to suspend ourself after one run
***************
*** 251,262 ****
else if (nearestToTheBall()){
if(m_myWorld.getBall().isBallKickableBy(m_myWorld.getMyself()))
! m_actions.kickTo(MAXPOWER,ENEMY_GOAL_POS,0); // schön ausrichten und voll draufhauen
else
! m_actions.runTo(NORMPOWER,m_myWorld.getBall(), m_myState.m_currentViewWidth);
}
}
else {
// Ich bin nicht dran
! watchBall();
return;
--- 253,264 ----
else if (nearestToTheBall()){
if(m_myWorld.getBall().isBallKickableBy(m_myWorld.getMyself()))
! m_actions.kickTo(MAXPOWER,ENEMY_GOAL_POS,m_myWorld.getViewModeAsInt()); // schön ausrichten und voll draufhauen
else
! m_actions.runTo(NORMPOWER,m_myWorld.getBall(), m_myWorld.getViewModeAsInt());
}
}
else {
// Ich bin nicht dran
! gotoHomePosition();
return;
***************
*** 285,304 ****
if (nearestToTheBall())
{
! if(m_myWorld.getBall().getDistance() < ServerConf.KICKABLE_MARGIN )
{
if(m_myWorld.getMyself().getAbsPosition().getX()<-30)
! l_tempPlayer =checkForPassPartner(20);
else if(m_myWorld.getMyself().getAbsPosition().getX()>40)
! l_tempPlayer =checkForPassPartner(-5);
else
! l_tempPlayer =checkForPassPartner(10);
if (l_tempPlayer != null)
! passTo(l_tempPlayer,m_myState.m_currentViewWidth);
else
! m_actions.kickTo(MAXPOWER,ENEMY_GOAL_POS,m_myState.m_currentViewWidth);
}
else
{
! m_actions.runTo(MINPOWER, m_myWorld.getBall(), m_myState.m_currentViewWidth);
}
}
--- 287,310 ----
if (nearestToTheBall())
{
! if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())>3.5)
! {
! m_actions.runTo(MINPOWER+5,new Coordinate(m_myWorld.getBall().getAbsPosition().getX()-3,m_myWorld.getBall().getAbsPosition().getY()),m_myWorld.getViewModeAsInt());
! }
! if(m_myWorld.getBall().getDistance() < ServerConf.KICKABLE_MARGIN + ServerConf.PLAYER_SIZE/2 +ServerConf.BALL_SIZE/2)
{
if(m_myWorld.getMyself().getAbsPosition().getX()<-30)
! l_tempPlayer =checkForPassPartner(25);
else if(m_myWorld.getMyself().getAbsPosition().getX()>40)
! l_tempPlayer =checkForPassPartner(-10);
else
! l_tempPlayer =checkForPassPartner(13);
if (l_tempPlayer != null)
! passTo(l_tempPlayer,m_myWorld.getViewModeAsInt());
else
! kickToCleverPosition(-1);
}
else
{
! m_actions.runTo(MINPOWER, m_myWorld.getBall(), m_myWorld.getViewModeAsInt());
}
}
***************
*** 308,313 ****
{
// Wir sind nicht dran :-(
! // Gehe ein wenig zurück, wenn ich zu bei Abstoss zu nah am Gegener stehe(stamina abzug)
! if(m_myWorld.getMyself().getDistanceTo(m_myWorld.getBall().getAbsPosition()) < 10)
{
m_actions.run((int)-NORMPOWER);
--- 314,319 ----
{
// Wir sind nicht dran :-(
! // Gehe ein wenig zurück, wenn ich zu nah am Gegner stehe(stamina abzug)
! if(m_myWorld.getMyDistanceTo(m_myWorld.getBall()) < 13)
{
m_actions.run((int)-NORMPOWER);
***************
*** 330,351 ****
{
// Is Ball Visible
! if(m_myWorld.getBall().isVisible()){
! if(m_myWorld.getBall().getDistance() < ServerConf.KICKABLE_MARGIN )
{
! l_tempPlayer =checkForPassPartner(10);
if (l_tempPlayer != null)
! passTo(l_tempPlayer,m_myState.m_currentViewWidth);
else
! m_actions.kickTo(MAXPOWER,ENEMY_GOAL_POS,m_myState.m_currentViewWidth);
}
else
{
! m_actions.runTo(MAXPOWER, m_myWorld.getBall(), m_myState.m_currentViewWidth);
}
-
}
else
searchBall();
-
}
}
--- 336,361 ----
{
// Is Ball Visible
! if(m_myWorld.getBall().isVisible())
! {
! if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())> 3)
{
! m_actions.runTo(MINPOWER+5, new Coordinate(m_myWorld.getBall().getAbsPosition().getX()-2.5,m_myWorld.getBall().getAbsPosition().getY()), m_myWorld.getViewModeAsInt());
! return;
! }
! if(m_myWorld.getBall().getDistance() < ServerConf.KICKABLE_MARGIN + ServerConf.PLAYER_SIZE/2 +ServerConf.BALL_SIZE/2)
! {
! l_tempPlayer =checkForPassPartner(25);
if (l_tempPlayer != null)
! passTo(l_tempPlayer,m_myWorld.getViewModeAsInt());
else
! kickToCleverPosition(-1);
}
else
{
! m_actions.runTo(MINPOWER+5, m_myWorld.getBall(), m_myWorld.getViewModeAsInt());
}
}
else
searchBall();
}
}
***************
*** 384,396 ****
/**
- * Go between the ball and an Enemy
- * @roseuid 3CE80E4F0251
- */
- private void goBetweenBallEnemy()
- {
-
- }
-
- /**
* Watch the ball
* @roseuid 3CE80EAF0138
--- 394,397 ----
***************
*** 440,444 ****
{
l_zaehler++;
! l_myTempPos=l_myTempPos.add(l_diffPos.scaleWith(l_zaehler));
l_nextDistance = l_myTempPos.getDistanceTo(getBallPosInRound(l_zaehler));
if (l_nextDistance < l_smallestDistance)
--- 441,445 ----
{
l_zaehler++;
! l_myTempPos=l_myTempPos.add(l_diffPos.scaleWith(m_myWorld.getViewModeAsInt()));
l_nextDistance = l_myTempPos.getDistanceTo(getBallPosInRound(l_zaehler));
if (l_nextDistance < l_smallestDistance)
***************
*** 449,456 ****
}
}
! m_actions.runTo(MAXPOWER,getBallPosInRound(l_estimatedCyclesToReachTheBall), m_myState.m_currentViewWidth);
}
else //ball doesnt move so simply go to its position
! m_actions.runTo(MAXPOWER,m_myWorld.getBall(), m_myState.m_currentViewWidth);
}
--- 450,457 ----
}
}
! m_actions.runTo(MAXPOWER,getBallPosInRound(l_estimatedCyclesToReachTheBall), m_myWorld.getViewModeAsInt());
}
else //ball doesnt move so simply go to its position
! m_actions.runTo(MAXPOWER,m_myWorld.getBall(), m_myWorld.getViewModeAsInt());
}
***************
*** 464,470 ****
// if it is behind us, simply run a bit backwards
if (m_myWorld.getBall().getDirection() > 0)
! m_actions.turn(m_myState.VIEW_ANGLES[m_myState.m_currentViewWidth]-15);
else
! m_actions.turn(-m_myState.VIEW_ANGLES[m_myState.m_currentViewWidth]+15);
}
--- 465,471 ----
// if it is behind us, simply run a bit backwards
if (m_myWorld.getBall().getDirection() > 0)
! m_actions.turn(SenseBodyInfo.getAngleFromViewMode(m_myWorld.getViewMode())-15);
else
! m_actions.turn(-SenseBodyInfo.getAngleFromViewMode(m_myWorld.getViewMode())+15);
}
***************
*** 491,495 ****
{
m_actions.kickTo(MAXPOWER, l_tempCoord,l_cycle);
- logger.debug("Goalpos: " + l_tempCoord.getY());
}
else
--- 492,495 ----
***************
*** 497,507 ****
l_tempPlayer =checkForPassPartner(10);
if (l_tempPlayer != null)
passTo(l_tempPlayer,l_cycle);
else
{
if (checkDribble())
dribble(l_cycle);
else
! m_actions.kickTo(MAXPOWER,ENEMY_GOAL_POS,l_cycle); //nix möglich, weghauen
}
}
--- 497,513 ----
l_tempPlayer =checkForPassPartner(10);
if (l_tempPlayer != null)
+ {
passTo(l_tempPlayer,l_cycle);
+ }
else
{
if (checkDribble())
+ {
dribble(l_cycle);
+ }
else
! {
! kickToCleverPosition(l_cycle);
! }
}
}
***************
*** 525,532 ****
else //no enemy in my range.
{
! if (atHomepos())
! watchBall();
! else
! gotoHomePosition();
}
}
--- 531,535 ----
else //no enemy in my range.
{
! gotoHomePosition();
}
}
***************
*** 553,556 ****
--- 556,562 ----
/** @todo do something clever here */
gotoHomePosition();
+ PlayerInfo l_player=enemyInRange();
+ if (l_player!=null) // we should walk free then
+ goBetweenBallAndEnemyAndWatchBall(l_player);
}
***************
*** 561,568 ****
private void gotoHomePosition()
{
double l_offsideBarrier=getOffsideBarrier(m_enemyTeam,m_ownTeam); //seems there are
if(m_myWorld.getMyself().getAbsPosition().getX()>l_offsideBarrier-3)
{
! m_actions.runTo(NORMPOWER + 10, new Coordinate( l_offsideBarrier-5, HOMEPOS[m_myWorld.getMyself().getBackNumber()].getY()), m_myState.m_currentViewWidth);
}
else if(atHomepos())
--- 567,579 ----
private void gotoHomePosition()
{
+ if (m_myState.m_currentViewWidth!=SenseBodyInfo.WIDE)
+ {
+ m_actions.changeView(SenseBodyInfo.WIDE,true);
+ m_myState.m_currentViewWidth=SenseBodyInfo.WIDE;
+ }
double l_offsideBarrier=getOffsideBarrier(m_enemyTeam,m_ownTeam); //seems there are
if(m_myWorld.getMyself().getAbsPosition().getX()>l_offsideBarrier-3)
{
! m_actions.runTo(NORMPOWER , new Coordinate( l_offsideBarrier-5, HOMEPOS[m_myWorld.getMyself().getBackNumber()].getY()), m_myWorld.getViewModeAsInt());
}
else if(atHomepos())
***************
*** 571,576 ****
{
if (m_myWorld.getSenseBodyInfo().m_stamina > 1500)
! //m_actions.runTo (NORMPOWER + 10, HOMEPOS[m_myState.getState()][m_myWorld.getMyself().getBackNumber()]);
! m_actions.runTo(NORMPOWER + 10, HOMEPOS[m_myWorld.getMyself().getBackNumber()], m_myState.m_currentViewWidth);
}
}
--- 582,586 ----
{
if (m_myWorld.getSenseBodyInfo().m_stamina > 1500)
! m_actions.runTo(NORMPOWER , HOMEPOS[m_myWorld.getMyself().getBackNumber()], m_myWorld.getViewModeAsInt());
}
}
***************
*** 592,596 ****
l_runToPos.setY(MY_GOAL_POS.getY() + (-Math.sin(l_angleOfBall) * f_radius));
if (Math.abs(m_myWorld.getMyself().getDistanceTo(l_runToPos)) > 0.8)
! m_actions.runTo(MAXPOWER, l_runToPos, m_myState.m_currentViewWidth);
else
watchBall();
--- 602,606 ----
l_runToPos.setY(MY_GOAL_POS.getY() + (-Math.sin(l_angleOfBall) * f_radius));
if (Math.abs(m_myWorld.getMyself().getDistanceTo(l_runToPos)) > 0.8)
! m_actions.runTo(NORMPOWER, l_runToPos, m_myWorld.getViewModeAsInt());
else
watchBall();
***************
*** 603,607 ****
private void gotoEnemy(PlayerInfo f_player)
{
! m_actions.runTo(NORMPOWER, (f_player.getAbsPositionOfNextRound() != null) ? f_player.getAbsPositionOfNextRound() : f_player.getAbsPosition(), m_myState.m_currentViewWidth);
}
--- 613,617 ----
private void gotoEnemy(PlayerInfo f_player)
{
! m_actions.runTo(NORMPOWER, (f_player.getAbsPositionOfNextRound() != null) ? f_player.getAbsPositionOfNextRound() : f_player.getAbsPosition(), m_myWorld.getViewModeAsInt());
}
***************
*** 613,643 ****
if (m_myWorld.getBall().isVisible())
{
! if (m_myWorld.getMyself().getDistanceTo(getBallPosInRound(0)) < (ServerConf.CATCHABLE_AREA_L ))
! {
! m_actions.catchTheBall(0);
! return;
! }
! else if (m_myWorld.getMyself().getDistanceTo( getBallPosInRound(1)) < (ServerConf.CATCHABLE_AREA_L ))
! {
! m_actions.catchTheBall(1);
! return;
! }
! else if (m_myWorld.getMyself().getDistanceTo( getBallPosInRound(2)) < (ServerConf.CATCHABLE_AREA_L ))
{
! m_actions.catchTheBall(2);
return;
}
else
{
! if (nearestToTheBall())
{
! takeTheBall();
! return;
}
else
! {
! goBetweenBallGoalAndWatchIt(ServerConf.GOAL_WIDTH / 2);
! return;
! }
}
}
--- 623,652 ----
if (m_myWorld.getBall().isVisible())
{
! int l_cycles = isBallCatchable();
! if (l_cycles>=0)
{
! m_actions.catchTheBall(l_cycles);
return;
}
else
{
! int l_cycle=isBallKickableByMe();
! if (l_cycle >= 0)
{
! PlayerInfo l_tempPlayer =checkForPassPartner(30);
! if (l_tempPlayer != null)
! {
! passTo(l_tempPlayer,l_cycle);
! }
! else
! {
! kickToCleverPosition(l_cycle);
! }
}
else
! if (nearestToTheBall())
! takeTheBall();
! else
! goBetweenBallGoalAndWatchIt(ServerConf.GOAL_WIDTH/2);
}
}
***************
*** 645,652 ****
{
searchBall();
- return;
}
}
/**
* Return the best position for a goalkick if a goalkick is posible
--- 654,679 ----
{
searchBall();
}
}
+ private int isBallCatchable()
+ {
+ if ((Math.abs(m_myWorld.getBall().getAbsPosition().getY())<20 && m_myWorld.getBall().getAbsPosition().getX()<-36)
+ && m_myWorld.getMyself().getDistanceTo(getBallPosInRound(0)) <= ServerConf.CATCHABLE_AREA_L )
+ {
+ return 0;
+ }
+ else if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null
+ && (Math.abs(m_myWorld.getBall().getAbsPositionOfNextRound().getY())<20 && m_myWorld.getBall().getAbsPositionOfNextRound().getX()<-36)
+ && m_myWorld.getMyDistanceTo(m_myWorld.getBall().getAbsPositionOfNextRound()) <= ServerConf.CATCHABLE_AREA_L )
+ {
+ return 1;
+ }
+ return -1;
+ }
+
+
+
+
/**
* Return the best position for a goalkick if a goalkick is posible
***************
*** 687,699 ****
{
l_enemyPlayer = (PlayerInfo)it.next();
! if (Math.abs(m_myWorld.getBodyDirectionTo(l_enemyPlayer) - m_myWorld.getBodyDirectionTo(l_middleOfGoal)) < FREE_ANGLE_FOR_GOAL_KICK)
{
l_middleOfGoal = null;
}
! if (Math.abs(m_myWorld.getBodyDirectionTo(l_enemyPlayer) - m_myWorld.getBodyDirectionTo(l_shortCorner)) < FREE_ANGLE_FOR_GOAL_KICK)
{
l_shortCorner = null;
}
! if (Math.abs(m_myWorld.getBodyDirectionTo(l_enemyPlayer) - m_myWorld.getBodyDirectionTo(l_longCorner)) < FREE_ANGLE_FOR_GOAL_KICK)
{
l_longCorner = null;
--- 714,726 ----
{
l_enemyPlayer = (PlayerInfo)it.next();
! if ( l_middleOfGoal!=null && Math.abs(m_myWorld.getBodyDirectionTo(l_enemyPlayer) - m_myWorld.getBodyDirectionTo(l_middleOfGoal)) < FREE_ANGLE_FOR_GOAL_KICK)
{
l_middleOfGoal = null;
}
! if (l_shortCorner != null && Math.abs(m_myWorld.getBodyDirectionTo(l_enemyPlayer) - m_myWorld.getBodyDirectionTo(l_shortCorner)) < FREE_ANGLE_FOR_GOAL_KICK)
{
l_shortCorner = null;
}
! if (l_longCorner!=null && Math.abs(m_myWorld.getBodyDirectionTo(l_enemyPlayer) - m_myWorld.getBodyDirectionTo(l_longCorner)) < FREE_ANGLE_FOR_GOAL_KICK)
{
l_longCorner = null;
***************
*** 784,791 ****
}
*/
! /**
! * Returns true if I am the nearest to the ball in the next cycles
! * @return boolean
! */
private boolean nearestToTheBall()
{
--- 811,818 ----
}
*/
! /**
! * Returns true if I am the nearest to the ball in the next cycles
! * @return boolean
! */
private boolean nearestToTheBall()
{
***************
*** 872,876 ****
if (Math.abs(m_myWorld.getBodyDirectionTo(l_possiblePassPartner)-m_myWorld.getBodyDirectionTo(l_enemyPlayer)) > FREE_ANGLE
|| (Math.abs(m_myWorld.getBodyDirectionTo(l_possiblePassPartner)-m_myWorld.getBodyDirectionTo(l_enemyPlayer)) < FREE_ANGLE
! && m_myWorld.getMyDistanceTo(l_possiblePassPartner) +6 < m_myWorld.getMyDistanceTo(l_enemyPlayer)
)
)
--- 899,903 ----
if (Math.abs(m_myWorld.getBodyDirectionTo(l_possiblePassPartner)-m_myWorld.getBodyDirectionTo(l_enemyPlayer)) > FREE_ANGLE
|| (Math.abs(m_myWorld.getBodyDirectionTo(l_possiblePassPartner)-m_myWorld.getBodyDirectionTo(l_enemyPlayer)) < FREE_ANGLE
! && m_myWorld.getMyDistanceTo(l_possiblePassPartner) +2 < m_myWorld.getMyDistanceTo(l_enemyPlayer)
)
)
***************
*** 977,982 ****
else
{
! if ((m_myWorld.getMyself().getAbsPosition()).getX() < 0) //if i'm in the enemys half, don't go between ball and goal
goBetweenBallGoalAndWatchIt(f_player.getDistanceTo(MY_GOAL_POS) * 0.85);
}
}
--- 1004,1011 ----
else
{
! if ((m_myWorld.getMyself().getAbsPosition()).getX() > 0)
goBetweenBallGoalAndWatchIt(f_player.getDistanceTo(MY_GOAL_POS) * 0.85);
+ else
+ goBetweenBallAndEnemyAndWatchBall(f_player);
}
}
***************
*** 1030,1034 ****
private void passTo(PlayerInfo f_player, int f_cycle)
{
! double l_kickpower = Math.min(100, (m_myWorld.getMyDistanceTo(f_player) * 3.5));
m_actions.kickTo(l_kickpower, f_player, f_cycle);
}
--- 1059,1063 ----
private void passTo(PlayerInfo f_player, int f_cycle)
{
! double l_kickpower = Math.min(100, (m_myWorld.getMyDistanceTo(f_player) * 4.5));
m_actions.kickTo(l_kickpower, f_player, f_cycle);
}
***************
*** 1061,1066 ****
{
l_deltaBall = m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
! l_finalPos = l_deltaBall.scaleWith(f_cycles); // Verlängern
! l_finalPos = l_finalPos.scaleWith(Math.pow(ServerConf.BALL_DECAY,f_cycles-1)); // Verlust
l_finalPos=m_myWorld.getBall().getAbsPosition().add(l_finalPos);
return l_finalPos;
--- 1090,1094 ----
{
l_deltaBall = m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
! l_finalPos = l_deltaBall.scaleWith(f_cycles*Math.pow(ServerConf.BALL_DECAY,f_cycles-1)); // Verlängern
l_finalPos=m_myWorld.getBall().getAbsPosition().add(l_finalPos);
return l_finalPos;
***************
*** 1127,1144 ****
private void manageViewMode()
{
if(!m_myWorld.getBall().isVisible())
{
m_myState.m_searchingBall=true;
! if (m_myWorld.sorry_whatTimeDoWeHave()-m_myWorld.getBall().getTime()>m_myState.m_currentViewWidth)
{
if (m_myState.m_currentViewWidth!=SenseBodyInfo.WIDE)
m_actions.changeView(SenseBodyInfo.WIDE,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.WIDE;
}
else
{
if (m_myState.m_currentViewWidth!=SenseBodyInfo.NORMAL)
m_actions.changeView(SenseBodyInfo.NORMAL,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.NORMAL;
}
}
--- 1155,1177 ----
private void manageViewMode()
{
+
if(!m_myWorld.getBall().isVisible())
{
m_myState.m_searchingBall=true;
! if (m_myWorld.sorry_whatTimeDoWeHave()-m_myWorld.getBall().getTime()> 6)
{
if (m_myState.m_currentViewWidth!=SenseBodyInfo.WIDE)
+ {
m_actions.changeView(SenseBodyInfo.WIDE,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.WIDE;
! }
}
else
{
if (m_myState.m_currentViewWidth!=SenseBodyInfo.NORMAL)
+ {
m_actions.changeView(SenseBodyInfo.NORMAL,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.NORMAL;
! }
}
}
***************
*** 1146,1168 ****
{
m_myState.m_searchingBall=false;
! if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 4 && Math.abs(m_myWorld.getBall().getDirection())<StateManager.VIEW_ANGLES[SenseBodyInfo.NARROW]/2)
{
if (m_myState.m_currentViewWidth!=SenseBodyInfo.NARROW)
m_actions.changeView(SenseBodyInfo.NARROW,true);
m_myState.m_currentViewWidth=SenseBodyInfo.NARROW;
}
! else if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 25 && Math.abs(m_myWorld.getBall().getDirection())<StateManager.VIEW_ANGLES[SenseBodyInfo.NORMAL]/2)
{
if (m_myState.m_currentViewWidth !=SenseBodyInfo.NORMAL)
m_actions.changeView(SenseBodyInfo.NORMAL,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.NORMAL;
}
else
{
if (m_myState.m_currentViewWidth !=SenseBodyInfo.WIDE)
m_actions.changeView(SenseBodyInfo.WIDE,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.WIDE;
}
}
}
}
--- 1179,1257 ----
{
m_myState.m_searchingBall=false;
! /* if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 4 && Math.abs(m_myWorld.getBall().getDirection())<StateManager.VIEW_ANGLES[SenseBodyInfo.NARROW]/2)
{
if (m_myState.m_currentViewWidth!=SenseBodyInfo.NARROW)
m_actions.changeView(SenseBodyInfo.NARROW,true);
m_myState.m_currentViewWidth=SenseBodyInfo.NARROW;
+
}
!
! else */if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 35 && Math.abs(m_myWorld.getBall().getDirection())<StateManager.VIEW_ANGLES[SenseBodyInfo.NORMAL]/2)
{
if (m_myState.m_currentViewWidth !=SenseBodyInfo.NORMAL)
+ {
m_actions.changeView(SenseBodyInfo.NORMAL,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.NORMAL;
! }
}
else
{
if (m_myState.m_currentViewWidth !=SenseBodyInfo.WIDE)
+ {
m_actions.changeView(SenseBodyInfo.WIDE,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.WIDE;
! }
}
}
+ }
+
+ private void kickToCleverPosition(int f_cycles)
+ {
+ PlayerInfo l_enemyPlayer = null;
+ if(f_cycles==-1)
+ f_cycles=m_myWorld.getViewModeAsInt();
+ if (m_myWorld.getMyself().getAbsPosition().getX() > 10 || m_enemyTeam.isEmpty())
+ {
+ if (Math.abs(m_myWorld.getMyself().getAbsPosition().getY()) < 20)
+ m_actions.kickTo(MAXPOWER, ENEMY_GOAL_POS, f_cycles);
+ else
+ m_actions.kickTo(NORMPOWER+15, new Coordinate(45, 0), f_cycles);
+ return;
+ }
+ for (ListIterator it = m_enemyTeam.listIterator(); it.hasNext();)
+ {
+ l_enemyPlayer = (PlayerInfo)it.next();
+ if (m_myWorld.getMyDistanceTo(l_enemyPlayer) < MIN_DISTANCE_FOR_DRIBBEL)
+ {
+ if (l_enemyPlayer.getDirection() < 0)
+ {
+ if (m_myWorld.getMyself().getAbsPosition().getX() > -30)
+ m_actions.kickTo(MAXPOWER-20, new Coordinate(30, 15), f_cycles);
+ else
+ m_actions.kickTo(MAXPOWER-20, new Coordinate(0, 20), f_cycles);
+ }
+ else
+ {
+ if (m_myWorld.getMyself().getAbsPosition().getX() > -30)
+ m_actions.kickTo(MAXPOWER-20, new Coordinate(30, -15), f_cycles);
+ else
+ m_actions.kickTo(MAXPOWER-20, new Coordinate(0, -20), f_cycles);
+ }
+ return;
+ }
+ }
+ m_actions.kickTo(MAXPOWER, ENEMY_GOAL_POS, f_cycles);
+ }
+
+ private void goBetweenBallAndEnemyAndWatchBall(PlayerInfo f_player)
+ {
+ Coordinate l_playerPos=(m_myWorld.getBall().getAbsPositionOfNextRound() != null) ? m_myWorld.getBall().getAbsPositionOfNextRound() : m_myWorld.getBall().getAbsPosition();
+ Coordinate l_coord=l_playerPos.sub((f_player.getAbsPositionOfNextRound()!=null)?f_player.getAbsPositionOfNextRound():f_player.getAbsPosition());
+ //now we've the vector from the guy to the ball, so move onto that, half a meter away from the player
+ l_coord=l_playerPos.add(l_coord.normalize());
+ if (m_myWorld.getMyDistanceTo(l_coord)<2)
+ watchBall();
+ else
+ m_actions.runTo(NORMPOWER,l_coord,m_myWorld.getViewModeAsInt());
}
}
Index: ActionManager.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/ActionManager.java,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** ActionManager.java 14 Jul 2002 22:56:40 -0000 1.61
--- ActionManager.java 15 Jul 2002 09:27:23 -0000 1.62
***************
*** 19,23 ****
{
! static final double DRIBBELKICKPOWER = 0.4;
// Params for the RunTo-Method
--- 19,23 ----
{
! static final double DRIBBELKICKPOWER = 0.3;
// Params for the RunTo-Method
***************
*** 77,95 ****
case 0:
// Ball ist nah genug zu kicken
! m_actionList.add(m_actionList.size(),new Action(KICK, f_power * DRIBBELKICKPOWER ,
m_myWorld.getBodyDirectionTo(f_position)));
! m_actionList.add(m_actionList.size(),new Action(TURN, m_myWorld.getBodyDirectionTo(f_position) , 0));
! m_actionList.add(m_actionList.size(),new Action(DASH, f_power , 0));
break;
case 1:
nop();
! m_actionList.add(m_actionList.size(),new Action(KICK, f_power * DRIBBELKICKPOWER ,
m_myWorld.getBodyDirectionTo(f_position)));
! m_actionList.add(m_actionList.size(),new Action(TURN, m_myWorld.getBodyDirectionTo(f_position) , 0));
break;
case 2:
nop();
nop();
! m_actionList.add(m_actionList.size(),new Action(KICK, f_power * DRIBBELKICKPOWER ,
m_myWorld.getBodyDirectionTo(f_position)));
break;
--- 77,95 ----
case 0:
// Ball ist nah genug zu kicken
! addLastToActionList(new Action(KICK, f_power * DRIBBELKICKPOWER ,
m_myWorld.getBodyDirectionTo(f_position)));
! addLastToActionList(new Action(TURN, m_myWorld.getBodyDirectionTo(f_position) , 0));
! addLastToActionList(new Action(DASH, f_power , 0));
break;
case 1:
nop();
! addLastToActionList(new Action(KICK, f_power * DRIBBELKICKPOWER ,
m_myWorld.getBodyDirectionTo(f_position)));
! addLastToActionList(new Action(TURN, m_myWorld.getBodyDirectionTo(f_position) , 0));
break;
case 2:
nop();
nop();
! addLastToActionList(new Action(KICK, f_power * DRIBBELKICKPOWER ,
m_myWorld.getBodyDirectionTo(f_position)));
break;
***************
*** 114,123 ****
double l_turnedDirection=m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
double l_moment= l_turnedDirection * moment();
- /* if (Math.abs(l_turnedDirection)>20)
- {
- m_actionList.add(m_actionList.size(),new Action(TURN,l_moment,0));
- return;
- }
- */
Coordinate l_posOfBallInNextRound=null;
Coordinate l_posOfBallOverNextRound=null;
--- 114,117 ----
***************
*** 131,135 ****
case 0:
l_kickDir=m_myWorld.getBodyDirectionTo(f_position);
! m_actionList.add(m_actionList.size(),new Action(KICK, f_power, l_kickDir ));
break;
case 1:
--- 125,129 ----
case 0:
l_kickDir=m_myWorld.getBodyDirectionTo(f_position);
! addLastToActionList(new Action(KICK, f_power, l_kickDir ));
break;
case 1:
***************
*** 151,162 ****
l_kickDir=m_myWorld.getBodyDirectionTo(f_position)- l_turnedDirection ;
! m_actionList.add(m_actionList.size(),new Action(DASH,l_dashPwr , 0));
! m_actionList.add(m_actionList.size(),new Action(KICK, f_power, l_kickDir ));
break;
! /* case 2:
! System.out.println("wanted to kick in 2 cycle");
// Is Ball moving?
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null) {
! // Position of the ball when finally kicking
l_posDiff=m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
l_posOfBallOverOverNextRound=m_myWorld.getBall().getAbsPositionOfNextRound().
--- 145,155 ----
l_kickDir=m_myWorld.getBodyDirectionTo(f_position)- l_turnedDirection ;
! addLastToActionList(new Action(DASH,l_dashPwr , 0));
! addLastToActionList(new Action(KICK, f_power, l_kickDir ));
break;
! case 2:
// Is Ball moving?
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null) {
! // Position of the ball when finally kicking
l_posDiff=m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
l_posOfBallOverOverNextRound=m_myWorld.getBall().getAbsPositionOfNextRound().
***************
*** 164,177 ****
add(l_posDiff.scaleWith(ServerConf.BALL_DECAY*ServerConf.BALL_DECAY));
! // Direction of the ball when finally kicking
l_turnedDirection=m_myWorld.getBodyDirectionTo(l_posOfBallOverOverNextRound);
! // Moment of the ball when finally kicking
l_moment= l_turnedDirection * moment();
l_dashPwr= edp2pwr(m_myWorld.getMyself().getDistanceTo(l_posOfBallOverOverNextRound)-MINDISTTOBALL
-(m_myWorld.getSenseBodyInfo().m_amountOfSpeed
! *Math.pow(ServerConf.PLAYER_DECAY,3)));
}
else{
! //Ball is not moving, but maybe myself
l_turnedDirection=m_myWorld.getBodyDirectionTo( m_myWorld.getBall());
l_moment= l_turnedDirection * moment();
--- 157,170 ----
add(l_posDiff.scaleWith(ServerConf.BALL_DECAY*ServerConf.BALL_DECAY));
! // Direction of the ball when finally kicking
l_turnedDirection=m_myWorld.getBodyDirectionTo(l_posOfBallOverOverNextRound);
! // Moment of the ball when finally kicking
l_moment= l_turnedDirection * moment();
l_dashPwr= edp2pwr(m_myWorld.getMyself().getDistanceTo(l_posOfBallOverOverNextRound)-MINDISTTOBALL
-(m_myWorld.getSenseBodyInfo().m_amountOfSpeed
! *Math.pow(ServerConf.PLAYER_DECAY,3)));
}
else{
! //Ball is not moving, but maybe myself
l_turnedDirection=m_myWorld.getBodyDirectionTo( m_myWorld.getBall());
l_moment= l_turnedDirection * moment();
***************
*** 183,197 ****
//l_dashPwr=Math.max(0,l_dashPwr);
l_dashPwr=Math.min(100,l_dashPwr);
! m_actionList.add(m_actionList.size(),new Action(TURN, l_moment, 0));
! m_actionList.add(m_actionList.size(),new Action(DASH, l_dashPwr,0));
! m_actionList.add(m_actionList.size(),new Action(KICK, f_power, l_kickDir ));
!
! // logger.debug("Turn: " + l_moment + " DashPwr: " + l_dashPwr + " KickDir: " + l_kickDir );
! // logger.debug("distance: " + m_myWorld.getBall().getDistance()+ " dashpower: " + l_dashPwr);
! // logger.debug("speed: " + m_myWorld.getSenseBodyInfo().m_amountOfSpeed );
break;
default:
logger.debug("Hier hat jemand den falschen Cycle errechnet");
- */
}
}
--- 176,185 ----
//l_dashPwr=Math.max(0,l_dashPwr);
l_dashPwr=Math.min(100,l_dashPwr);
! addLastToActionList(new Action(TURN, l_moment, 0));
! addLastToActionList(new Action(DASH, l_dashPwr,0));
! addLastToActionList(new Action(KICK, f_power, l_kickDir ));
break;
default:
logger.debug("Hier hat jemand den falschen Cycle errechnet");
}
}
***************
*** 327,331 ****
if (Math.abs(l_angleToTurnNeck+m_myWorld.getNeckDirection())>90) //dont break ya neck
{
! changeView(++m_myState.m_currentViewWidth,true);
}
m_myCom.turnNeck(l_angleToTurnNeck);
--- 315,320 ----
if (Math.abs(l_angleToTurnNeck+m_myWorld.getNeckDirection())>90) //dont break ya neck
{
! changeView(m_myState.m_currentViewWidth+1,true);
! m_myState.m_currentViewWidth++;
}
m_myCom.turnNeck(l_angleToTurnNeck);
***************
*** 343,347 ****
if (Math.abs(l_actionAngle+m_myWorld.getNeckDirection())>90) //dont break ya neck
{
! changeView(++m_myState.m_currentViewWidth,true);
}
// m_myWorld.informTurnNeck(l_actionAngle);
--- 332,337 ----
if (Math.abs(l_actionAngle+m_myWorld.getNeckDirection())>90) //dont break ya neck
{
! changeView(m_myState.m_currentViewWidth+1,true);
! m_myState.m_currentViewWidth++;
}
// m_myWorld.informTurnNeck(l_actionAngle);
***************
*** 369,373 ****
public void run(int f_power)
{
! m_actionList.add(m_actionList.size(),new Action(DASH, f_power, 0));
}
--- 359,363 ----
public void run(int f_power)
{
! addLastToActionList(new Action(DASH, f_power, 0));
}
***************
*** 397,401 ****
if(Math.abs(l_deltaAngle)>TOLERANCEANGLE)
{
! m_actionList.add(m_actionList.size(),new Action(TURN,l_moment,0));
l_turnHappened=true;
}
--- 387,391 ----
if(Math.abs(l_deltaAngle)>TOLERANCEANGLE)
{
! addLastToActionList(new Action(TURN,l_moment,0));
l_turnHappened=true;
}
***************
*** 407,411 ****
l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position) - ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
// logger.fatal("narrow dash sent"+Math.min(100,l_power));
! m_actionList.add(m_actionList.size(),new Action(DASH,Math.min(100,l_power),0));
}
break;
--- 397,401 ----
l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position) - ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
// logger.fatal("narrow dash sent"+Math.min(100,l_power));
! addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
}
break;
***************
*** 415,419 ****
l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position) - ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
// logger.fatal("normal dash sent(with turn)"+Math.min(l_power,100));
! m_actionList.add(m_actionList.size(),new Action(DASH,Math.min(100,l_power),0));
}
else
--- 405,409 ----
l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position) - ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
// logger.fatal("normal dash sent(with turn)"+Math.min(l_power,100));
! addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
}
else
***************
*** 421,426 ****
l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
// logger.fatal("normal dash sent(wo turn)"+Math.min(100,l_power));
! m_actionList.add(m_actionList.size(),new Action(DASH,Math.min(100,l_power),0));
! m_actionList.add(m_actionList.size(),new Action(DASH,Math.min(100,l_power),0));
}
break;
--- 411,416 ----
l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
// logger.fatal("normal dash sent(wo turn)"+Math.min(100,l_power));
! addLastToActionList(new Action(DASH,Math.min(100,l_power/2),0));
! addLastToActionList(new Action(DASH,Math.min(100,l_power/2),0));
}
break;
***************
*** 428,439 ****
if(!l_turnHappened)
{
! m_actionList.add(m_actionList.size(),new Action(DASH,f_power,0));
! m_actionList.add(m_actionList.size(),new Action(DASH,f_power,0));
! m_actionList.add(m_actionList.size(),new Action(DASH,f_power,0));
}
else
{
! m_actionList.add(m_actionList.size(),new Action(DASH,f_power,0));
! m_actionList.add(m_actionList.size(),new Action(DASH,f_power,0));
}
break;
--- 418,431 ----
if(!l_turnHappened)
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
! addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
! addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
! addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
}
else
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
! addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
! addLastToActionList(new Action(DASH,Math.min(100,l_power),0));
}
break;
***************
*** 463,467 ****
public void turn(double f_angle)
{
! m_actionList.add(m_actionList.size(),new Action(TURN, f_angle*moment(),0));
}
--- 455,459 ----
public void turn(double f_angle)
{
! addLastToActionList(new Action(TURN, f_angle*moment(),0));
}
***************
*** 477,493 ****
case 0:
l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
! m_actionList.add(m_actionList.size(),new Action(CATCHBALL, l_deltaAngle, 0));
break;
case 1:
! l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall().getAbsPositionOfNextRound());
! nop();
! m_actionList.add(m_actionList.size(),new Action(CATCHBALL, l_deltaAngle, 0));
! break;
! case 2:
! Coordinate l_coord = m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
! l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall().getAbsPositionOfNextRound().add(l_coord.scaleWith(ServerConf.BALL_DECAY)));
! nop();
nop();
! m_actionList.add(m_actionList.size(),new Action(CATCHBALL, l_deltaAngle, 0));
break;
}
--- 469,478 ----
case 0:
l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
! addLastToActionList(new Action(CATCHBALL, l_deltaAngle, 0));
break;
case 1:
! l_deltaAngle= m_myWorld.getBodyDirectionTo( (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)?m_myWorld.getBall().getAbsPositionOfNextRound():m_myWorld.getBall().getAbsPosition() );
nop();
! addLastToActionList(new Action(CATCHBALL, l_deltaAngle, 0));
break;
}
***************
*** 503,507 ****
public void moveTo(Coordinate f_coord)
{
! m_actionList.add(m_actionList.size(),new Action(MOVE, f_coord.getX(), f_coord.getY()));
}
--- 488,492 ----
public void moveTo(Coordinate f_coord)
{
! addLastToActionList(new Action(MOVE, f_coord.getX(), f_coord.getY()));
}
***************
*** 512,516 ****
public void nop()
{
! m_actionList.add(m_actionList.size(),new Action(NOP, 0,0));
}
--- 497,501 ----
public void nop()
{
! addLastToActionList(new Action(NOP, 0,0));
}
***************
*** 551,554 ****
--- 536,547 ----
}
+ private void addLastToActionList(Action f_action)
+ {
+ synchronized (m_actionList)
+ {
+ m_actionList.add(m_actionList.size(),f_action);
+ }
+ }
+
/**
*
***************
*** 674,678 ****
try
{
! sleep(90);
performAction();
// logger.fatal("action performed"+System.currentTimeMillis());
--- 667,674 ----
try
{
! synchronized(this)
! {
! wait(70);
! }
performAction();
// logger.fatal("action performed"+System.currentTimeMillis());
***************
*** 680,685 ****
catch (Exception ex)
{
! ex.printStackTrace();
! logger.fatal("running on....");
}
m_threadSuspended=true; //we want to suspend ourself after one run
--- 676,681 ----
catch (Exception ex)
{
! // ex.printStackTrace();
! // logger.fatal("running on....");
}
m_threadSuspended=true; //we want to suspend ourself after one run
|
|
From: <mae...@us...> - 2002-07-15 09:27:26
|
Update of /cvsroot/jais/jaisteam/src/jais/world In directory usw-pr-cvs1:/tmp/cvs-serv15661/world Modified Files: WorldModel.java WorldDataAccessInterface.java Log Message: many many cahnges ;) version 1.01 is ready ! Index: WorldModel.java =================================================================== RCS file: /cvsroot/jais/jaisteam/src/jais/world/WorldModel.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** WorldModel.java 14 Jul 2002 22:56:40 -0000 1.59 --- WorldModel.java 15 Jul 2002 09:27:22 -0000 1.60 *************** *** 6,9 **** --- 6,11 ---- import jais.objects.*; import jais.communication.*; + import javax.sound.sampled.*; + import java.io.*; /** *************** *** 22,26 **** private int m_playerNumber; // where the playerNumber is stored ! private final int FORGET_TIME= 3*10; // x-seconds private final double NOT_MOVING=0.01; // if deltaVector is smaller than we say Object did not move --- 24,28 ---- private int m_playerNumber; // where the playerNumber is stored ! private final int FORGET_TIME= 2*10; // x-seconds private final double NOT_MOVING=0.01; // if deltaVector is smaller than we say Object did not move *************** *** 36,39 **** --- 38,42 ---- private LinkedList m_currentlyUsedFlags; private LinkedList m_currentlyUsedLines; + // private short[] m_scoring={0,0}; boolean m_playingOnLeftSide; // where we store on which side we play *************** *** 243,246 **** --- 246,260 ---- } + public int getViewModeAsInt() + { + String l_blub = getViewMode(); + if (l_blub.startsWith("normal")) + return 1; + else if (l_blub.startsWith("wide")) + return 2; + else + return 0; + } + /****************************************************************************************/ /* Here starts the implementation of the WorldUpdateInterface *************** *** 255,258 **** --- 269,282 ---- case AurealInfo.AUREAL_SENDER_REFEREE: m_lastRefereeMessage=l_aurealInfo; + if(m_lastRefereeMessage.m_playmode== AurealInfo.GOAL_L && m_playingOnLeftSide || m_lastRefereeMessage.m_playmode== AurealInfo.GOAL_R && !m_playingOnLeftSide) + { + // m_scoring[0]++; + if (m_playerNumber==1) + { + ClipPlayer l_blub=new ClipPlayer(new File("../ext/1.wav"),1); + } + } + else if (m_lastRefereeMessage.m_playmode== AurealInfo.GOAL_L || m_lastRefereeMessage.m_playmode== AurealInfo.GOAL_R) + // m_scoring[1]++; break; case AurealInfo.AUREAL_SENDER_OTHER: *************** *** 268,277 **** break; } ! logger.info("Player"+m_playerNumber+"added a hearEvent to my list"); } public synchronized void updateVisualInfo(VisualEvent f_visualEvent) { ! logger.info("updating my Visual Info and calculating absolute positions now"); ArrayList l_visualInfos=f_visualEvent.getObjects(); ObjectInfo l_objectInfo; --- 292,301 ---- break; } ! // logger.info("Player"+m_playerNumber+"added a hearEvent to my list"); } public synchronized void updateVisualInfo(VisualEvent f_visualEvent) { ! // logger.info("updating my Visual Info and calculating absolute positions now"); ArrayList l_visualInfos=f_visualEvent.getObjects(); ObjectInfo l_objectInfo; *************** *** 337,341 **** { m_senseBodyInfos.addLast(f_senseBodyEvent.getObjects().get(0)); ! logger.info("added a SenseBodyInfo to my List"); } --- 361,365 ---- { m_senseBodyInfos.addLast(f_senseBodyEvent.getObjects().get(0)); ! // logger.info("added a SenseBodyInfo to my List"); } *************** *** 346,350 **** if (!f_initialEvent.getObjects().isEmpty()) { ! logger.info("updating initial info's"); //get the one and only init info object InitInfo l_initInfo=(InitInfo)f_initialEvent.getObjects().get(0); --- 370,374 ---- if (!f_initialEvent.getObjects().isEmpty()) { ! // logger.info("updating initial info's"); //get the one and only init info object InitInfo l_initInfo=(InitInfo)f_initialEvent.getObjects().get(0); *************** *** 410,414 **** else if(l_tempAngle<-180) m_absBodyDir=360+f_angle; ! logger.debug("abs view angle from inform:"+ getAbsViewAngle()); logger.debug("abs bodyDir from inform:"+ getAbsBodyDir()); */ --- 434,438 ---- else if(l_tempAngle<-180) m_absBodyDir=360+f_angle; ! // logger.debug("abs view angle from inform:"+ getAbsViewAngle()); logger.debug("abs bodyDir from inform:"+ getAbsBodyDir()); */ *************** *** 434,438 **** l_2flagUpdateHappened=true; calculateMyAbsStuffWith2Flags(); ! logger.info("2Flags: Absolute Position : " + "(" + (int) m_myself.getAbsPosition().getX() + "|" +(int) m_myself.getAbsPosition().getY() + ")" + " Abs Angle: " + (int) getAbsViewAngle()); } if(!m_currentlySeenLines.isEmpty()) --- 458,462 ---- l_2flagUpdateHappened=true; calculateMyAbsStuffWith2Flags(); ! // logger.info("2Flags: Absolute Position : " + "(" + (int) m_myself.getAbsPosition().getX() + "|" +(int) m_myself.getAbsPosition().getY() + ")" + " Abs Angle: " + (int) getAbsViewAngle()); } if(!m_currentlySeenLines.isEmpty()) *************** *** 452,456 **** { calculateMyAbsStuffWithLineAndFlag(); ! logger.info("Line+Flag Absolute Position : " + "(" + (int) m_myself.getAbsPosition().getX() + "|" +(int) m_myself.getAbsPosition().getY() + ")" + " Abs Angle: " + (int) getAbsViewAngle()); } if (l_2flagUpdateHappened) --- 476,480 ---- { calculateMyAbsStuffWithLineAndFlag(); ! // logger.info("Line+Flag Absolute Position : " + "(" + (int) m_myself.getAbsPosition().getX() + "|" +(int) m_myself.getAbsPosition().getY() + ")" + " Abs Angle: " + (int) getAbsViewAngle()); } if (l_2flagUpdateHappened) *************** *** 459,468 **** m_absViewAngle=l_oldViewAngle; m_myself.setAbsPosition(l_oldPosition); ! logger.info("Corrected view Angle to " +l_oldViewAngle + "and Pos to" + l_oldPosition); } } else { ! logger.debug("Not enough information in the last see message for updating Position."); } /*set our body direction here and correct if necessary*/ --- 483,492 ---- m_absViewAngle=l_oldViewAngle; m_myself.setAbsPosition(l_oldPosition); ! // logger.info("Corrected view Angle to " +l_oldViewAngle + "and Pos to" + l_oldPosition); } } else { ! // logger.debug("Not enough information in the last see message for updating Position."); } /*set our body direction here and correct if necessary*/ *************** *** 650,699 **** private void updateAbsolutePositions() { ! logger.debug("Going to update my absolute positions"); ! /*************************************************************************************/ ! //update myself here calculateMyAbsStuff(); ! logger.info("Playing left? "+m_playingOnLeftSide); ! logger.info("Pos:" + m_myself.getAbsPosition() + "V Angle" + getAbsViewAngle() +"B Angle" + getAbsBodyDir()); ! /*************************************************************************************/ ! // update the ball here ! if (m_ball.isVisible()) ! { ! calculateAbsPosOfBall(); ! } ! else ! { ! logger.info("I dont see the ball :(("); ! } ! /*************************************************************************************/ ! // update the players here ! double l_absAngle; ! double l_dist; ! ObjectInfo l_tempObject; ! for (ListIterator it=m_currentlySeenPlayers.listIterator();it.hasNext();) { ! l_tempObject=(ObjectInfo)it.next(); //get the next player ! l_absAngle= Angle.toRadian(l_tempObject.getDirection()+getAbsViewAngle()); //get its direction and convert to Radian ! l_dist = l_tempObject.getDistance(); //get its distance ! l_tempObject.setAbsPosition(new Coordinate ( //and write its absPosition ! m_myself.getAbsPosition().getX()+Math.cos(l_absAngle)*l_dist, ! m_myself.getAbsPosition().getY()+Math.sin(l_absAngle)*l_dist ! )); ! if (l_tempObject.getDirChange()!=ObjectInfo.NOT_EXISTING && l_tempObject.getDistChange()!=ObjectInfo.NOT_EXISTING) ! { ! l_absAngle=Angle.toRadian(l_tempObject.getDirection()+l_tempObject.getDirChange() + getAbsViewAngle()); ! l_dist = l_tempObject.getDistance()+l_tempObject.getDistChange(); ! l_tempObject.setAbsPositionOfNextRound(new Coordinate( ! m_myself.getAbsPositionOfNextRound().getX()+Math.cos(l_absAngle)*l_dist, ! m_myself.getAbsPositionOfNextRound().getY()+Math.sin(l_absAngle)*l_dist) ! ); ! if (Math.abs(l_tempObject.getAbsPositionOfNextRound().getX()-l_tempObject.getAbsPosition().getX())<NOT_MOVING ! && Math.abs(l_tempObject.getAbsPositionOfNextRound().getY()-l_tempObject.getAbsPosition().getY())<NOT_MOVING) ! l_tempObject.setAbsPositionOfNextRound(null); ! } ! else ! l_tempObject.setAbsPositionOfNextRound(null); } ! l_tempObject=null; //dont need it anymore } --- 674,728 ---- private void updateAbsolutePositions() { ! // logger.debug("Going to update my absolute positions"); ! /*************************************************************************************/ ! //update myself here calculateMyAbsStuff(); ! // logger.info("Playing left? "+m_playingOnLeftSide); ! // logger.info("Pos:" + m_myself.getAbsPosition() + "V Angle" + getAbsViewAngle() +"B Angle" + getAbsBodyDir()); ! /*************************************************************************************/ ! // update the ball here ! if (m_ball.isVisible()) ! { ! calculateAbsPosOfBall(); ! } ! /*else if (sorry_whatTimeDoWeHave()-m_ball.getTime()< 7) { ! Coordinate l_nextRound =(m_ball.getAbsPositionOfNextRound()!=null)? m_ball.getAbsPositionOfNextRound() : m_ball.getAbsPosition(); ! Coordinate l_moving=l_nextRound.sub(m_ball.getAbsPosition()); ! m_ball.setAbsPosition(l_nextRound); ! m_ball.setAbsPositionOfNextRound(m_ball.getAbsPosition().add(l_moving.scaleWith(ServerConf.BALL_DECAY))); ! // logger.info("I dont see the ball :(("); } ! */ ! /*************************************************************************************/ ! // update the players here ! double l_absAngle; ! double l_dist; ! ObjectInfo l_tempObject; ! for (ListIterator it=m_currentlySeenPlayers.listIterator();it.hasNext();) ! { ! l_tempObject=(ObjectInfo)it.next(); //get the next player ! l_absAngle= Angle.toRadian(l_tempObject.getDirection()+getAbsViewAngle()); //get its direction and convert to Radian ! l_dist = l_tempObject.getDistance(); //get its distance ! l_tempObject.setAbsPosition(new Coordinate ( //and write its absPosition ! m_myself.getAbsPosition().getX()+Math.cos(l_absAngle)*l_dist, ! m_myself.getAbsPosition().getY()+Math.sin(l_absAngle)*l_dist ! )); ! if (l_tempObject.getDirChange()!=ObjectInfo.NOT_EXISTING && l_tempObject.getDistChange()!=ObjectInfo.NOT_EXISTING) ! { ! l_absAngle=Angle.toRadian(l_tempObject.getDirection()+l_tempObject.getDirChange() + getAbsViewAngle()); ! l_dist = l_tempObject.getDistance()+l_tempObject.getDistChange(); ! l_tempObject.setAbsPositionOfNextRound(new Coordinate( ! m_myself.getAbsPositionOfNextRound().getX()+Math.cos(l_absAngle)*l_dist, ! m_myself.getAbsPositionOfNextRound().getY()+Math.sin(l_absAngle)*l_dist) ! ); ! if (Math.abs(l_tempObject.getAbsPositionOfNextRound().getX()-l_tempObject.getAbsPosition().getX())<NOT_MOVING ! && Math.abs(l_tempObject.getAbsPositionOfNextRound().getY()-l_tempObject.getAbsPosition().getY())<NOT_MOVING) ! l_tempObject.setAbsPositionOfNextRound(null); ! } ! else ! l_tempObject.setAbsPositionOfNextRound(null); ! } ! l_tempObject=null; //dont need it anymore } *************** *** 726,731 **** else m_ball.setAbsPositionOfNextRound(null); ! logger.debug("Pos of ball"+m_ball.getAbsPosition()); ! logger.debug("Pos of ball next round:"+m_ball.getAbsPositionOfNextRound()); } --- 755,760 ---- else m_ball.setAbsPositionOfNextRound(null); ! // logger.debug("Pos of ball"+m_ball.getAbsPosition()); ! // logger.debug("Pos of ball next round:"+m_ball.getAbsPositionOfNextRound()); } *************** *** 847,851 **** m_enemyTeam.remove(l_oldPlayer); m_enemyTeam.add(l_newPlayer); ! logger.info("we found someone cause of its position"); } else //maybe he is in our team --- 876,880 ---- m_enemyTeam.remove(l_oldPlayer); m_enemyTeam.add(l_newPlayer); ! // logger.info("we found someone cause of its position"); } else //maybe he is in our team *************** *** 856,860 **** m_ownTeam.remove(l_oldPlayer); m_ownTeam.add(l_newPlayer); ! logger.info("we found someone cause of its position"); } } --- 885,889 ---- m_ownTeam.remove(l_oldPlayer); m_ownTeam.add(l_newPlayer); ! // logger.info("we found someone cause of its position"); } } *************** *** 922,926 **** }//playerIsInList() ! /** * Sets a whole ObjectInfo list to visible true or false * @param f_objectInfoList list to modify --- 951,955 ---- }//playerIsInList() ! /** * Sets a whole ObjectInfo list to visible true or false * @param f_objectInfoList list to modify *************** *** 940,943 **** --- 969,1031 ---- } return f_objectInfoList; + } + } + class blub implements LineListener + { + public void update (LineEvent f_event) + { + } + } + + class ClipPlayer implements LineListener + { + private Clip m_clip; + + + /* + *The clip will be played nLoopCount + 1 times. + */ + public ClipPlayer(File clipFile, int nLoopCount) + { + AudioInputStream audioInputStream = null; + try + { + audioInputStream = AudioSystem.getAudioInputStream(clipFile); + } + catch (Exception e) + { + //e.printStackTrace(); + } + if (audioInputStream != null) + { + AudioFormat format = audioInputStream.getFormat(); + DataLine.Info info = new DataLine.Info(Clip.class, format); + try + { + m_clip = (Clip) AudioSystem.getLine(info); + m_clip.addLineListener(this); + m_clip.open(audioInputStream); + } + catch (LineUnavailableException e) + { + //e.printStackTrace(); + } + catch (IOException e) + { + //e.printStackTrace(); + } + m_clip.loop(nLoopCount); + } + } + public void update(LineEvent event) + { + if (event.getType().equals(LineEvent.Type.STOP)) + { + m_clip.close(); + } + else if (event.getType().equals(LineEvent.Type.CLOSE)) + { + } + } } Index: WorldDataAccessInterface.java =================================================================== RCS file: /cvsroot/jais/jaisteam/src/jais/world/WorldDataAccessInterface.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** WorldDataAccessInterface.java 14 Jul 2002 22:56:40 -0000 1.11 --- WorldDataAccessInterface.java 15 Jul 2002 09:27:22 -0000 1.12 *************** *** 136,139 **** --- 136,142 ---- public String getViewMode(); + + public int getViewModeAsInt(); + /** * |
|
From: <mae...@us...> - 2002-07-15 09:27:26
|
Update of /cvsroot/jais/jaisteam/src/jais/objects
In directory usw-pr-cvs1:/tmp/cvs-serv15661/objects
Modified Files:
FlagInfo.java Coordinate.java AurealInfo.java
Log Message:
many many cahnges ;) version 1.01 is ready !
Index: FlagInfo.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/objects/FlagInfo.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** FlagInfo.java 8 Jul 2002 07:17:57 -0000 1.10
--- FlagInfo.java 15 Jul 2002 09:27:23 -0000 1.11
***************
*** 87,114 ****
public String getFlagType(){return m_flagType;}
- /**
- * Method to switch all the flag positions
- * This is done if we play on left side
- */
- public static synchronized void switchFlagPositions()
- {
- /*this is corrected in the positioning System at the moment
- System.out.println("------------------------tried");
- if (!m_alreadySwitched)
- {
- System.out.println("------------------------switched");
- Coordinate l_tempCoord;
- Object l_tempKey;
- for(Enumeration e=FLAG_POSITIONS.keys();e.hasMoreElements();)
- {
- l_tempKey=e.nextElement();
- l_tempCoord=(Coordinate)FLAG_POSITIONS.get(l_tempKey);
- FLAG_POSITIONS.put(l_tempKey, (new Coordinate(-l_tempCoord.getX(), -l_tempCoord.getY())));
- }
- m_alreadySwitched=true;
- }
- */
- }
-
public Coordinate getAbsPosition()
{
--- 87,90 ----
Index: Coordinate.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/objects/Coordinate.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Coordinate.java 8 Jul 2002 06:41:08 -0000 1.12
--- Coordinate.java 15 Jul 2002 09:27:24 -0000 1.13
***************
*** 108,111 ****
--- 108,116 ----
}
+ public Coordinate normalize()
+ {
+ return (this.scaleWith(Math.sqrt(m_x*m_x+m_y*m_y)));
+ }
+
/**
* This method calculates the distance between this coordinate and f_coord
Index: AurealInfo.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/objects/AurealInfo.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** AurealInfo.java 8 Jul 2002 00:17:40 -0000 1.8
--- AurealInfo.java 15 Jul 2002 09:27:24 -0000 1.9
***************
*** 23,30 ****
public static final int CORNER_KICK_L = 9;
public static final int CORNER_KICK_R = 10;
! public static final int GOAL_KICK_L = 11;
! public static final int GOAL_KICK_R = 12;
! public static final int GOAL_L = 13;
! public static final int GOAL_R = 14;
public static final int DROP_BALL = 15;
public static final int OFFSIDE_L = 16;
--- 23,30 ----
public static final int CORNER_KICK_L = 9;
public static final int CORNER_KICK_R = 10;
! public static final int GOAL_L = 11;
! public static final int GOAL_R = 12;
! public static final int GOAL_KICK_L = 13;
! public static final int GOAL_KICK_R = 14;
public static final int DROP_BALL = 15;
public static final int OFFSIDE_L = 16;
***************
*** 54,61 ****
"corner_kick_l",
"corner_kick_r",
"goal_kick_l",
"goal_kick_r",
- "goal_l",
- "goal_r",
"drop_ball",
"offside_l",
--- 54,61 ----
"corner_kick_l",
"corner_kick_r",
+ "goal_l",
+ "goal_r",
"goal_kick_l",
"goal_kick_r",
"drop_ball",
"offside_l",
|
|
From: <mae...@us...> - 2002-07-14 22:56:43
|
Update of /cvsroot/jais/jaisteam/src/jais/player
In directory usw-pr-cvs1:/tmp/cvs-serv30379/player
Modified Files:
StateManager.java KI.java ActionManager.java
Log Message:
viewmodes added & more
checkgoalkick new progged by bombenleger
...
many bugs....
Index: StateManager.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/StateManager.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** StateManager.java 13 Jul 2002 20:29:24 -0000 1.13
--- StateManager.java 14 Jul 2002 22:56:40 -0000 1.14
***************
*** 20,26 ****
int m_state= 1;
public static final int[] VIEW_ANGLES={45,90,180};
! public int m_currentViewMode=1;
!
int m_actionCounter = 0;
/**
* Returns if we are offense or defense
--- 20,28 ----
int m_state= 1;
public static final int[] VIEW_ANGLES={45,90,180};
! public int m_currentViewWidth=1; // 0 , 1, 2
! public int m_currentViewQuality=1; // 0 for LOW, 1 for HIGH
! public boolean m_searchingBall=false;
int m_actionCounter = 0;
+
/**
* Returns if we are offense or defense
Index: KI.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/KI.java,v
retrieving revision 1.78
retrieving revision 1.79
diff -C2 -d -r1.78 -r1.79
*** KI.java 14 Jul 2002 14:01:23 -0000 1.78
--- KI.java 14 Jul 2002 22:56:40 -0000 1.79
***************
*** 35,39 ****
/*defense*/ new Coordinate(-25,20), new Coordinate(-30,7), new Coordinate(-30,-7),new Coordinate(-25,-20),
/*midfield*/ new Coordinate(0,10), new Coordinate(0,0), new Coordinate(0,-10),
! /*attackers*/ new Coordinate(30,15), new Coordinate(25,0), new Coordinate(30,-15)};
private final Coordinate GOALIE_HOME_POS = new Coordinate(-50, 0);
--- 35,39 ----
/*defense*/ new Coordinate(-25,20), new Coordinate(-30,7), new Coordinate(-30,-7),new Coordinate(-25,-20),
/*midfield*/ new Coordinate(0,10), new Coordinate(0,0), new Coordinate(0,-10),
! /*attackers*/ new Coordinate(30,18), new Coordinate(25,0), new Coordinate(30,-18)};
private final Coordinate GOALIE_HOME_POS = new Coordinate(-50, 0);
***************
*** 47,57 ****
private final Coordinate ENEMY_GOAL_POS = new Coordinate(52.5, 0);
private final int MAX_GOAL_KICK_DISTANCE = 25;
! private final int MIN_DISTANCE_FOR_DRIBBEL = 5;
private final int MAX_PASS_DISTANCE =30;
private final int MAX_LOOKING_FORWARD_TIME = 20;
! private final int FREE_ANGLE = 15;
! private int m_searchAngle;
ArrayList m_enemyTeam;
--- 47,58 ----
private final Coordinate ENEMY_GOAL_POS = new Coordinate(52.5, 0);
private final int MAX_GOAL_KICK_DISTANCE = 25;
! private final int MIN_DISTANCE_FOR_DRIBBEL = 10;
private final int MAX_PASS_DISTANCE =30;
private final int MAX_LOOKING_FORWARD_TIME = 20;
! private final int MAX_ANGLE_FOR_GOAL_KICK = 75;
! private final int FREE_ANGLE_FOR_GOAL_KICK = 5;
! private final int FREE_ANGLE = 15;
ArrayList m_enemyTeam;
***************
*** 73,78 ****
this.setName("KI"+f_playerNumber);
m_myWorld = f_world;
- m_actions = new ActionManager(m_myWorld, f_myCom, f_playerNumber);
m_myState = new StateManager();
}
--- 74,79 ----
this.setName("KI"+f_playerNumber);
m_myWorld = f_world;
m_myState = new StateManager();
+ m_actions = new ActionManager(m_myWorld, f_myCom, f_playerNumber, m_myState);
}
***************
*** 121,124 ****
--- 122,126 ----
}//of while()
//logger.info("\t" + getName() + ": i've left my while-loop. run() will stop immediatly
+
}
***************
*** 251,255 ****
m_actions.kickTo(MAXPOWER,ENEMY_GOAL_POS,0); // schön ausrichten und voll draufhauen
else
! m_actions.runTo(NORMPOWER,m_myWorld.getBall(), m_myState.m_currentViewMode);
}
}
--- 253,257 ----
m_actions.kickTo(MAXPOWER,ENEMY_GOAL_POS,0); // schön ausrichten und voll draufhauen
else
! m_actions.runTo(NORMPOWER,m_myWorld.getBall(), m_myState.m_currentViewWidth);
}
}
***************
*** 292,302 ****
l_tempPlayer =checkForPassPartner(10);
if (l_tempPlayer != null)
! passTo(l_tempPlayer,0);
else
! kickTo(ENEMY_GOAL_POS,0);
}
else
{
! m_actions.runTo(MINPOWER, m_myWorld.getBall(), m_myState.m_currentViewMode);
}
}
--- 294,304 ----
l_tempPlayer =checkForPassPartner(10);
if (l_tempPlayer != null)
! passTo(l_tempPlayer,m_myState.m_currentViewWidth);
else
! m_actions.kickTo(MAXPOWER,ENEMY_GOAL_POS,m_myState.m_currentViewWidth);
}
else
{
! m_actions.runTo(MINPOWER, m_myWorld.getBall(), m_myState.m_currentViewWidth);
}
}
***************
*** 309,313 ****
if(m_myWorld.getMyself().getDistanceTo(m_myWorld.getBall().getAbsPosition()) < 10)
{
! m_actions.run((int)-MINPOWER);
}
else
--- 311,315 ----
if(m_myWorld.getMyself().getDistanceTo(m_myWorld.getBall().getAbsPosition()) < 10)
{
! m_actions.run((int)-NORMPOWER);
}
else
***************
*** 320,326 ****
* @param f_forLeftSide
*/
! private void goalKick(boolean f_forLeftSide){
PlayerInfo l_tempPlayer;
! if(m_myWorld.getMyself().isGoalie()){
if ((m_myWorld.isPlayingLeft()&& f_forLeftSide) || (!m_myWorld.isPlayingLeft()&& !f_forLeftSide ))
{
--- 322,330 ----
* @param f_forLeftSide
*/
! private void goalKick(boolean f_forLeftSide)
! {
PlayerInfo l_tempPlayer;
! if(m_myWorld.getMyself().isGoalie())
! {
if ((m_myWorld.isPlayingLeft()&& f_forLeftSide) || (!m_myWorld.isPlayingLeft()&& !f_forLeftSide ))
{
***************
*** 331,341 ****
l_tempPlayer =checkForPassPartner(10);
if (l_tempPlayer != null)
! passTo(l_tempPlayer,0);
else
! kickTo(ENEMY_GOAL_POS,0);
}
else
{
! m_actions.runTo(MAXPOWER, m_myWorld.getBall(), m_myState.m_currentViewMode);
}
--- 335,345 ----
l_tempPlayer =checkForPassPartner(10);
if (l_tempPlayer != null)
! passTo(l_tempPlayer,m_myState.m_currentViewWidth);
else
! m_actions.kickTo(MAXPOWER,ENEMY_GOAL_POS,m_myState.m_currentViewWidth);
}
else
{
! m_actions.runTo(MAXPOWER, m_myWorld.getBall(), m_myState.m_currentViewWidth);
}
***************
*** 346,350 ****
}
}
!
}
--- 350,360 ----
}
}
! else //not the goalie
! {
! if (m_myWorld.getBall().isVisible())
! gotoHomePosition();
! else
! searchBall();
! }
}
***************
*** 404,410 ****
double l_ballSpeed = 0;
Coordinate l_diffPos;
! if (m_myWorld.getBall().getAbsPositionOfNextRound() != null) //&& m_myWorld.getMyDistanceTo(m_myWorld.getBall()) < 1.5)
{
! if (m_myWorld.getMyDistanceTo(m_myWorld.getBall().getAbsPosition()) >= m_myWorld.getMyDistanceTo(m_myWorld.getBall().getAbsPositionOfNextRound()))
{
//Ball kommt zu mir
--- 414,420 ----
double l_ballSpeed = 0;
Coordinate l_diffPos;
! if (m_myWorld.getBall().getAbsPositionOfNextRound() != null)
{
! if (m_myWorld.getMyDistanceTo(m_myWorld.getBall()) >= m_myWorld.getMyDistanceTo(m_myWorld.getBall().getAbsPositionOfNextRound()))
{
//Ball kommt zu mir
***************
*** 412,417 ****
while (l_zaehler < MAX_LOOKING_FORWARD_TIME )
{
! l_zaehler+=m_myState.m_currentViewMode+1;
! l_nextDistance = m_myWorld.getMyself().getDistanceTo(getBallPosInRound(l_zaehler));
if (l_nextDistance < l_smallestDistance)
{
--- 422,427 ----
while (l_zaehler < MAX_LOOKING_FORWARD_TIME )
{
! l_zaehler++;
! l_nextDistance = m_myWorld.getMyDistanceTo(getBallPosInRound(l_zaehler));
if (l_nextDistance < l_smallestDistance)
{
***************
*** 429,434 ****
while (l_zaehler < MAX_LOOKING_FORWARD_TIME )
{
! l_myTempPos=l_myTempPos.add(l_diffPos.scaleWith(3));
! l_zaehler+=m_myState.m_currentViewMode+1;
l_nextDistance = l_myTempPos.getDistanceTo(getBallPosInRound(l_zaehler));
if (l_nextDistance < l_smallestDistance)
--- 439,444 ----
while (l_zaehler < MAX_LOOKING_FORWARD_TIME )
{
! l_zaehler++;
! l_myTempPos=l_myTempPos.add(l_diffPos.scaleWith(l_zaehler));
l_nextDistance = l_myTempPos.getDistanceTo(getBallPosInRound(l_zaehler));
if (l_nextDistance < l_smallestDistance)
***************
*** 439,448 ****
}
}
! m_actions.runTo(MAXPOWER,getBallPosInRound(l_estimatedCyclesToReachTheBall), m_myState.m_currentViewMode);
}
- // else if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
- // m_actions.runTo(MAXPOWER,m_myWorld.getBall().getAbsPositionOfNextRound());
else //ball doesnt move so simply go to its position
! m_actions.runTo(MAXPOWER,m_myWorld.getBall(), m_myState.m_currentViewMode);
}
--- 449,456 ----
}
}
! m_actions.runTo(MAXPOWER,getBallPosInRound(l_estimatedCyclesToReachTheBall), m_myState.m_currentViewWidth);
}
else //ball doesnt move so simply go to its position
! m_actions.runTo(MAXPOWER,m_myWorld.getBall(), m_myState.m_currentViewWidth);
}
***************
*** 454,461 ****
{
//check where the ball was the last time we saw it and turn to that direction
if (m_myWorld.getBall().getDirection() > 0)
! m_actions.turn(m_myState.VIEW_ANGLES[m_myState.m_currentViewMode]-15);
else
! m_actions.turn(-m_myState.VIEW_ANGLES[m_myState.m_currentViewMode]+15);
}
--- 462,470 ----
{
//check where the ball was the last time we saw it and turn to that direction
+ // if it is behind us, simply run a bit backwards
if (m_myWorld.getBall().getDirection() > 0)
! m_actions.turn(m_myState.VIEW_ANGLES[m_myState.m_currentViewWidth]-15);
else
! m_actions.turn(-m_myState.VIEW_ANGLES[m_myState.m_currentViewWidth]+15);
}
***************
*** 475,493 ****
else
{
- /* if (m_myWorld.getMyself().getBackNumber()==2)
- if (m_myWorld.getBall().getAbsPositionOfNextRound() !=null){
- logger.debug("BallPos Now:" + m_myWorld.getBall().getAbsPosition());
- logger.debug("BallPos Next:" + m_myWorld.getBall().getAbsPositionOfNextRound());
- }
- else
- logger.debug("Ball is not moving");
- */
int l_cycle=isBallKickableByMe();
! if (l_cycle >= 0) //hab den ball
! // if(m_myWorld.getBall().isVisible() && m_myWorld.getBall().isBallKickableBy(m_myWorld.getMyself()))
{
l_tempCoord = checkGoalKick();
! if (l_tempCoord != null){
! kickTo( l_tempCoord,l_cycle);
logger.debug("Goalpos: " + l_tempCoord.getY());
}
--- 484,494 ----
else
{
int l_cycle=isBallKickableByMe();
! if (m_myWorld.getBall().isVisible() && l_cycle >= 0) //hab den ball
{
l_tempCoord = checkGoalKick();
! if (l_tempCoord != null)
! {
! m_actions.kickTo(MAXPOWER, l_tempCoord,l_cycle);
logger.debug("Goalpos: " + l_tempCoord.getY());
}
***************
*** 502,506 ****
dribble(l_cycle);
else
! kickTo(ENEMY_GOAL_POS,l_cycle); //nix möglich, weghauen
}
}
--- 503,507 ----
dribble(l_cycle);
else
! m_actions.kickTo(MAXPOWER,ENEMY_GOAL_POS,l_cycle); //nix möglich, weghauen
}
}
***************
*** 563,567 ****
if(m_myWorld.getMyself().getAbsPosition().getX()>l_offsideBarrier-3)
{
! m_actions.runTo(NORMPOWER + 10, new Coordinate( l_offsideBarrier-8, HOMEPOS[m_myWorld.getMyself().getBackNumber()].getY()), m_myState.m_currentViewMode);
}
else if(atHomepos())
--- 564,568 ----
if(m_myWorld.getMyself().getAbsPosition().getX()>l_offsideBarrier-3)
{
! m_actions.runTo(NORMPOWER + 10, new Coordinate( l_offsideBarrier-5, HOMEPOS[m_myWorld.getMyself().getBackNumber()].getY()), m_myState.m_currentViewWidth);
}
else if(atHomepos())
***************
*** 569,575 ****
else
{
! if (m_myWorld.getSenseBodyInfo().m_stamina > 1000)
//m_actions.runTo (NORMPOWER + 10, HOMEPOS[m_myState.getState()][m_myWorld.getMyself().getBackNumber()]);
! m_actions.runTo(NORMPOWER + 10, HOMEPOS[m_myWorld.getMyself().getBackNumber()], m_myState.m_currentViewMode);
}
}
--- 570,576 ----
else
{
! if (m_myWorld.getSenseBodyInfo().m_stamina > 1500)
//m_actions.runTo (NORMPOWER + 10, HOMEPOS[m_myState.getState()][m_myWorld.getMyself().getBackNumber()]);
! m_actions.runTo(NORMPOWER + 10, HOMEPOS[m_myWorld.getMyself().getBackNumber()], m_myState.m_currentViewWidth);
}
}
***************
*** 591,595 ****
l_runToPos.setY(MY_GOAL_POS.getY() + (-Math.sin(l_angleOfBall) * f_radius));
if (Math.abs(m_myWorld.getMyself().getDistanceTo(l_runToPos)) > 0.8)
! m_actions.runTo(MAXPOWER, l_runToPos, m_myState.m_currentViewMode);
else
watchBall();
--- 592,596 ----
l_runToPos.setY(MY_GOAL_POS.getY() + (-Math.sin(l_angleOfBall) * f_radius));
if (Math.abs(m_myWorld.getMyself().getDistanceTo(l_runToPos)) > 0.8)
! m_actions.runTo(MAXPOWER, l_runToPos, m_myState.m_currentViewWidth);
else
watchBall();
***************
*** 602,606 ****
private void gotoEnemy(PlayerInfo f_player)
{
! m_actions.runTo(MAXPOWER, f_player.getAbsPosition(), m_myState.m_currentViewMode);
}
--- 603,607 ----
private void gotoEnemy(PlayerInfo f_player)
{
! m_actions.runTo(NORMPOWER, (f_player.getAbsPositionOfNextRound() != null) ? f_player.getAbsPositionOfNextRound() : f_player.getAbsPosition(), m_myState.m_currentViewWidth);
}
***************
*** 612,626 ****
if (m_myWorld.getBall().isVisible())
{
! if (m_myWorld.getMyself().getDistanceTo(getBallPosInRound(1)) < (ServerConf.CATCHABLE_AREA_L + (ServerConf.PLAYER_SIZE / 2) ))
{
m_actions.catchTheBall(0);
return;
}
! else if (m_myWorld.getMyself().getDistanceTo( getBallPosInRound(2)) < (ServerConf.CATCHABLE_AREA_L + (ServerConf.PLAYER_SIZE / 2) ))
{
m_actions.catchTheBall(1);
return;
}
! else if (m_myWorld.getMyself().getDistanceTo( getBallPosInRound(3)) < (ServerConf.CATCHABLE_AREA_L + (ServerConf.PLAYER_SIZE / 2) ))
{
m_actions.catchTheBall(2);
--- 613,627 ----
if (m_myWorld.getBall().isVisible())
{
! if (m_myWorld.getMyself().getDistanceTo(getBallPosInRound(0)) < (ServerConf.CATCHABLE_AREA_L ))
{
m_actions.catchTheBall(0);
return;
}
! else if (m_myWorld.getMyself().getDistanceTo( getBallPosInRound(1)) < (ServerConf.CATCHABLE_AREA_L ))
{
m_actions.catchTheBall(1);
return;
}
! else if (m_myWorld.getMyself().getDistanceTo( getBallPosInRound(2)) < (ServerConf.CATCHABLE_AREA_L ))
{
m_actions.catchTheBall(2);
***************
*** 652,659 ****
* @return Coordinate
*/
private Coordinate checkGoalKick()
{
double l_myAngleToGoal = 0.0;
- /** Find the best position on goal **/
PlayerInfo l_players;
--- 653,728 ----
* @return Coordinate
*/
+ /** Find the best position on goal **/
private Coordinate checkGoalKick()
{
+ if (!m_enemyTeam.isEmpty())
+ {
+ if (m_myWorld.getMyDistanceTo(ENEMY_GOAL_POS) > MAX_GOAL_KICK_DISTANCE) //Distance to great for a succesful goal kick
+ return null;
+
+ PlayerInfo l_enemyPlayer = null;
+ Coordinate l_shortCorner = ENEMY_GOAL_POS;
+ Coordinate l_longCorner = ENEMY_GOAL_POS;
+ Coordinate l_middleOfGoal = ENEMY_GOAL_POS;
+ double l_angleToGoal = 0;
+
+ l_angleToGoal = Math.atan((Math.abs(ENEMY_GOAL_POS.getY() - m_myWorld.getMyself().getAbsPosition().getY()) ) / (Math.abs(ENEMY_GOAL_POS.getX() - m_myWorld.getMyself().getAbsPosition().getX())));
+ if (l_angleToGoal > MAX_ANGLE_FOR_GOAL_KICK)
+ return null;
+
+ //Checking where I'm standing
+ if (m_myWorld.getMyself().getAbsPosition().getY() > ENEMY_GOAL_POS.getY()) //standing 'under' the middle goal
+ {
+ l_shortCorner.setY(ENEMY_GOAL_POS.getY() + (ServerConf.GOAL_WIDTH / 2 ) - 2);
+ l_longCorner.setY(ENEMY_GOAL_POS.getY() - (ServerConf.GOAL_WIDTH / 2 ) + 2);
+ }
+ else //standing 'over' the middle of the goal
+ {
+ l_longCorner.setY(ENEMY_GOAL_POS.getY() + (ServerConf.GOAL_WIDTH / 2 ) - 2);
+ l_shortCorner.setY(ENEMY_GOAL_POS.getY() - (ServerConf.GOAL_WIDTH / 2 ) + 2);
+ }
+
+ //now checking if the way to the goal is free
+ for (ListIterator it = m_enemyTeam.listIterator(); it.hasNext();)
+ {
+ l_enemyPlayer = (PlayerInfo)it.next();
+ if (Math.abs(m_myWorld.getBodyDirectionTo(l_enemyPlayer) - m_myWorld.getBodyDirectionTo(l_middleOfGoal)) < FREE_ANGLE_FOR_GOAL_KICK)
+ {
+ l_middleOfGoal = null;
+ }
+ if (Math.abs(m_myWorld.getBodyDirectionTo(l_enemyPlayer) - m_myWorld.getBodyDirectionTo(l_shortCorner)) < FREE_ANGLE_FOR_GOAL_KICK)
+ {
+ l_shortCorner = null;
+ }
+ if (Math.abs(m_myWorld.getBodyDirectionTo(l_enemyPlayer) - m_myWorld.getBodyDirectionTo(l_longCorner)) < FREE_ANGLE_FOR_GOAL_KICK)
+ {
+ l_longCorner = null;
+ }
+ }
+ if (l_middleOfGoal != null)
+ return l_middleOfGoal;
+ if (l_shortCorner != null)
+ return l_shortCorner;
+ return l_longCorner; //if also null, return null
+
+ }
+ else //enemyList empty
+ {
+ if (m_myWorld.getMyDistanceTo(ENEMY_GOAL_POS) > MAX_GOAL_KICK_DISTANCE)
+ return null;
+ else
+ return ENEMY_GOAL_POS;
+ }
+
+ }
+
+
+
+
+
+
+ /* private Coordinate checkGoalKick()
+ {
double l_myAngleToGoal = 0.0;
PlayerInfo l_players;
***************
*** 669,673 ****
if (m_myWorld.getMyself().getDistanceTo(ENEMY_GOAL_POS) < MAX_GOAL_KICK_DISTANCE)
{
- /** Find the best position on goal **/
if (!m_enemyTeam.isEmpty())
{
--- 738,741 ----
***************
*** 696,701 ****
l_shootOnPos.setY(l_greatestDistPos/2-.5);
l_myAngleToGoal = m_myWorld.getBodyDirectionTo(l_shootOnPos);
- /**Now we should have the best Point to shoot on,
- Checking if way to goal is free **/
if (!m_enemyTeam.isEmpty())
{
--- 764,767 ----
***************
*** 717,721 ****
return null;
}
!
/**
* Returns true if I am the nearest to the ball in the next cycles
--- 783,787 ----
return null;
}
! */
/**
* Returns true if I am the nearest to the ball in the next cycles
***************
*** 747,751 ****
l_minDistanceToBall = l_distanceToBall;
} //playerList
! if (l_minDistanceToBall + TOLERANCE > m_myWorld.getMyDistanceTo( m_myWorld.getBall() ))
return true;
}
--- 813,817 ----
l_minDistanceToBall = l_distanceToBall;
} //playerList
! if (l_minDistanceToBall + TOLERANCE > m_myWorld.getMyDistanceTo(m_myWorld.getBall()))
return true;
}
***************
*** 884,900 ****
private boolean checkDribble()
{
- boolean l_dribble = true;
if (!m_enemyTeam.isEmpty())
{
for (ListIterator it = m_enemyTeam.listIterator(); it.hasNext();)
{
! if (m_myWorld.getMyDistanceTo(m_myWorld.getMyself()) < MIN_DISTANCE_FOR_DRIBBEL)
{
! l_dribble = false;
! break;
}
}
}
! return l_dribble;
}
--- 950,966 ----
private boolean checkDribble()
{
if (!m_enemyTeam.isEmpty())
{
+ if (m_myWorld.isPlayerBehind()) //theres a player behind me...so dont dribble
+ return false;
for (ListIterator it = m_enemyTeam.listIterator(); it.hasNext();)
{
! if (m_myWorld.getMyDistanceTo((PlayerInfo)it.next()) < MIN_DISTANCE_FOR_DRIBBEL)
{
! return false;
}
}
}
! return true;
}
***************
*** 950,972 ****
private boolean atHomepos()
{
-
//if (m_myWorld.getMyself().getDistanceTo(HOMEPOS[m_myState.getState()][m_myWorld.getMyself().getBackNumber()]) > HOMERANGE_R)
if (m_myWorld.getMyself().getDistanceTo(HOMEPOS[m_myWorld.getMyself().getBackNumber()]) > HOMERANGE_R)
return false;
! else return true; //at homepos
!
! }
!
! /**
! * Kick to a given Coordinate in a given cycle
! * @param f_coord
! * @param f_cycle
! */
! private void kickTo(Coordinate f_coord, int f_cycle)
! {
! Coordinate l_kickVector= f_coord.sub(m_myWorld.getMyself().getAbsPosition());
! //int l_kickpower = Math.min(100, 7*(int)Math.sqrt( l_kickVector.getX() *l_kickVector.getX() +l_kickVector.getY()*l_kickVector.getY()));
! double l_kickpower=MAXPOWER;
! m_actions.kickTo(l_kickpower, f_coord, f_cycle);
}
--- 1016,1024 ----
private boolean atHomepos()
{
//if (m_myWorld.getMyself().getDistanceTo(HOMEPOS[m_myState.getState()][m_myWorld.getMyself().getBackNumber()]) > HOMERANGE_R)
if (m_myWorld.getMyself().getDistanceTo(HOMEPOS[m_myWorld.getMyself().getBackNumber()]) > HOMERANGE_R)
return false;
! else
! return true; //at homepos
}
***************
*** 991,998 ****
double l_power;
Coordinate l_dribbleToPos;
-
l_power = MAXPOWER;
l_dribbleToPos = ENEMY_GOAL_POS;
-
m_actions.dribbelTo(l_power, l_dribbleToPos, f_cycle);
}
--- 1043,1048 ----
***************
*** 1000,1036 ****
/**
- * Returns the number of round when the ball is kickable
- * @return int
- */
- private int ballAvailableInNextRounds()
- {
- if (m_myWorld.getBall().isBallKickableBy(m_myWorld.getMyself()))
- return 0;
- else
- {
- if (m_myWorld.getMyself().getDistanceTo(getBallPosInRound(1)) < ServerConf.KICKABLE_MARGIN + (ServerConf.PLAYER_SIZE / 2 ) + (ServerConf.BALL_SIZE / 2))
- return 1;
- else
- {
- if (m_myWorld.getMyself().getDistanceTo(getBallPosInRound(2)) < ServerConf.KICKABLE_MARGIN + (ServerConf.PLAYER_SIZE / 2 ) + (ServerConf.BALL_SIZE / 2))
- return 2;
- }
- }
- return -1;
- }
-
-
- /**
* This method calculates at which position our Ball is after f_cycles
! * @param f_cycles defines how far we should look into the future
* @return Coordinate of future position
*/
private Coordinate getBallPosInRound(int f_cycles)
{
! Coordinate l_deltaBall = new Coordinate(0, 0);
! Coordinate l_finalPos = new Coordinate(0, 0);
! if (f_cycles ==0)
! return m_myWorld.getBall().getAbsPosition();
! else if (m_myWorld.getBall().getAbsPositionOfNextRound() != null)
{
l_deltaBall = m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
--- 1050,1062 ----
/**
* This method calculates at which position our Ball is after f_cycles
! * @param f_cycles defines how far we should look into the future (e.g. if f_cycles==1 we take AbsPosOfNextRound
* @return Coordinate of future position
*/
private Coordinate getBallPosInRound(int f_cycles)
{
! Coordinate l_deltaBall;
! Coordinate l_finalPos;
! if (f_cycles !=0 && m_myWorld.getBall().getAbsPositionOfNextRound() != null)
{
l_deltaBall = m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
***************
*** 1044,1049 ****
}
-
-
/**
* With this method the KI is started at the beginning
--- 1070,1073 ----
***************
*** 1083,1100 ****
* @return int
*/
! private int isBallKickableByMe(){
! if (m_myWorld.getBall().isVisible())
{
! if (m_myWorld.getBall().getDistance() < ServerConf.KICKABLE_MARGIN + (ServerConf.PLAYER_SIZE / 2 ) + (ServerConf.BALL_SIZE / 2))
! {
! // logger.debug("Pos in next: (0) " + m_myWorld.getBall().getAbsPositionOfNextRound());
! return 0;
! }
! else if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null && m_myWorld.getMyself().getDistanceTo( getBallPosInRound(1)) < ServerConf.KICKABLE_MARGIN + (ServerConf.PLAYER_SIZE / 2 ) + (ServerConf.BALL_SIZE / 2))
! {
! // logger.debug("Pos in next: (1)" + m_myWorld.getBall().getAbsPositionOfNextRound());
! // logger.debug("dist to ball in next round"+m_myWorld.getMyself().getDistanceTo( getBallPosInRound(1)));
! return 1;
! }
}
return -1;
--- 1107,1119 ----
* @return int
*/
! private int isBallKickableByMe()
! {
! if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< ServerConf.KICKABLE_MARGIN + (ServerConf.PLAYER_SIZE / 2 ) + (ServerConf.BALL_SIZE / 2))
{
! return 0;
! }
! else if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null && m_myWorld.getMyDistanceTo( m_myWorld.getBall().getAbsPositionOfNextRound()) < ServerConf.KICKABLE_MARGIN + (ServerConf.PLAYER_SIZE / 2 ) + (ServerConf.BALL_SIZE / 2))
! {
! return 1;
}
return -1;
***************
*** 1110,1144 ****
if(!m_myWorld.getBall().isVisible())
{
! if (m_myWorld.sorry_whatTimeDoWeHave()-m_myWorld.getBall().getTime()>6)
{
! if (m_myState.m_currentViewMode!=SenseBodyInfo.WIDE)
m_actions.changeView(SenseBodyInfo.WIDE,true);
! m_myState.m_currentViewMode=SenseBodyInfo.WIDE;
}
else
{
! if (m_myState.m_currentViewMode!=SenseBodyInfo.NORMAL)
m_actions.changeView(SenseBodyInfo.NORMAL,true);
! m_myState.m_currentViewMode=SenseBodyInfo.NORMAL;
}
}
! else if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 2)
! {
! if (m_myState.m_currentViewMode!=SenseBodyInfo.NARROW)
! m_actions.changeView(SenseBodyInfo.NARROW,true);
! m_myState.m_currentViewMode=SenseBodyInfo.NARROW;
! }
! else if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 40)
! {
! if (m_myState.m_currentViewMode!=SenseBodyInfo.NORMAL)
! m_actions.changeView(SenseBodyInfo.NORMAL,true);
! m_myState.m_currentViewMode=SenseBodyInfo.NORMAL;
! }
! else
{
! if (m_myState.m_currentViewMode!=SenseBodyInfo.WIDE)
! m_actions.changeView(SenseBodyInfo.WIDE,true);
! m_myState.m_currentViewMode=SenseBodyInfo.WIDE;
}
}
! }
--- 1129,1168 ----
if(!m_myWorld.getBall().isVisible())
{
! m_myState.m_searchingBall=true;
! if (m_myWorld.sorry_whatTimeDoWeHave()-m_myWorld.getBall().getTime()>m_myState.m_currentViewWidth)
{
! if (m_myState.m_currentViewWidth!=SenseBodyInfo.WIDE)
m_actions.changeView(SenseBodyInfo.WIDE,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.WIDE;
}
else
{
! if (m_myState.m_currentViewWidth!=SenseBodyInfo.NORMAL)
m_actions.changeView(SenseBodyInfo.NORMAL,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.NORMAL;
}
}
! else //ball is visible
{
! m_myState.m_searchingBall=false;
! if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 4 && Math.abs(m_myWorld.getBall().getDirection())<StateManager.VIEW_ANGLES[SenseBodyInfo.NARROW]/2)
! {
! if (m_myState.m_currentViewWidth!=SenseBodyInfo.NARROW)
! m_actions.changeView(SenseBodyInfo.NARROW,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.NARROW;
! }
! else if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 25 && Math.abs(m_myWorld.getBall().getDirection())<StateManager.VIEW_ANGLES[SenseBodyInfo.NORMAL]/2)
! {
! if (m_myState.m_currentViewWidth !=SenseBodyInfo.NORMAL)
! m_actions.changeView(SenseBodyInfo.NORMAL,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.NORMAL;
! }
! else
! {
! if (m_myState.m_currentViewWidth !=SenseBodyInfo.WIDE)
! m_actions.changeView(SenseBodyInfo.WIDE,true);
! m_myState.m_currentViewWidth=SenseBodyInfo.WIDE;
! }
}
}
! }
\ No newline at end of file
Index: ActionManager.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/ActionManager.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** ActionManager.java 14 Jul 2002 14:01:23 -0000 1.60
--- ActionManager.java 14 Jul 2002 22:56:40 -0000 1.61
***************
*** 8,12 ****
import org.apache.log4j.Logger;
-
/**
* <p>Title: Actionmanager</p>
--- 8,11 ----
***************
*** 37,41 ****
static final int NOP = 6;
-
private LinkedList m_actionList;
private WorldModel m_myWorld;
--- 36,39 ----
***************
*** 49,52 ****
--- 47,51 ----
private Thread m_performerThread;
private boolean m_threadSuspended;
+ private StateManager m_myState;
/**
* Creates a new <code>ActionManager</code> instance.
***************
*** 56,61 ****
* @roseuid 3CEB6AAA0062
*/
! public ActionManager(WorldModel f_myWorld, Communication f_myCom, int f_playerNumber)
{
this.setName("ActionPerformer"+f_playerNumber);
m_myWorld = f_myWorld;
--- 55,61 ----
* @roseuid 3CEB6AAA0062
*/
! public ActionManager(WorldModel f_myWorld, Communication f_myCom, int f_playerNumber, StateManager f_stateManager)
{
+ m_myState=f_stateManager;
this.setName("ActionPerformer"+f_playerNumber);
m_myWorld = f_myWorld;
***************
*** 78,82 ****
// Ball ist nah genug zu kicken
m_actionList.add(m_actionList.size(),new Action(KICK, f_power * DRIBBELKICKPOWER ,
! m_myWorld.getBodyDirectionTo(f_position)));
m_actionList.add(m_actionList.size(),new Action(TURN, m_myWorld.getBodyDirectionTo(f_position) , 0));
m_actionList.add(m_actionList.size(),new Action(DASH, f_power , 0));
--- 78,82 ----
// Ball ist nah genug zu kicken
m_actionList.add(m_actionList.size(),new Action(KICK, f_power * DRIBBELKICKPOWER ,
! m_myWorld.getBodyDirectionTo(f_position)));
m_actionList.add(m_actionList.size(),new Action(TURN, m_myWorld.getBodyDirectionTo(f_position) , 0));
m_actionList.add(m_actionList.size(),new Action(DASH, f_power , 0));
***************
*** 85,89 ****
nop();
m_actionList.add(m_actionList.size(),new Action(KICK, f_power * DRIBBELKICKPOWER ,
! m_myWorld.getBodyDirectionTo(f_position)));
m_actionList.add(m_actionList.size(),new Action(TURN, m_myWorld.getBodyDirectionTo(f_position) , 0));
break;
--- 85,89 ----
nop();
m_actionList.add(m_actionList.size(),new Action(KICK, f_power * DRIBBELKICKPOWER ,
! m_myWorld.getBodyDirectionTo(f_position)));
m_actionList.add(m_actionList.size(),new Action(TURN, m_myWorld.getBodyDirectionTo(f_position) , 0));
break;
***************
*** 92,96 ****
nop();
m_actionList.add(m_actionList.size(),new Action(KICK, f_power * DRIBBELKICKPOWER ,
! m_myWorld.getBodyDirectionTo(f_position)));
break;
default:
--- 92,96 ----
nop();
m_actionList.add(m_actionList.size(),new Action(KICK, f_power * DRIBBELKICKPOWER ,
! m_myWorld.getBodyDirectionTo(f_position)));
break;
default:
***************
*** 111,117 ****
public void kickTo(double f_power, Coordinate f_position, int f_cycle)
{
! logger.debug("Kickto Cycles: " + f_cycle);
double l_turnedDirection=m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
double l_moment= l_turnedDirection * moment();
Coordinate l_posOfBallInNextRound=null;
Coordinate l_posOfBallOverNextRound=null;
--- 111,123 ----
public void kickTo(double f_power, Coordinate f_position, int f_cycle)
{
! // logger.fatal("Kickto Cycles: " + f_cycle + " dist: " +m_myWorld.getMyDistanceTo(m_myWorld.getBall()) + "dir:" +(int)m_myWorld.getBodyDirectionTo(m_myWorld.getBall()));
double l_turnedDirection=m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
double l_moment= l_turnedDirection * moment();
+ /* if (Math.abs(l_turnedDirection)>20)
+ {
+ m_actionList.add(m_actionList.size(),new Action(TURN,l_moment,0));
+ return;
+ }
+ */
Coordinate l_posOfBallInNextRound=null;
Coordinate l_posOfBallOverNextRound=null;
***************
*** 129,138 ****
case 1:
// Is Ball moving?
- System.out.println("wanted to kick in 1 cycle");
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
{
// Position of the ball when finally kicking
l_posDiff=m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
! l_dashPwr= edp2pwr(m_myWorld.getMyself().getDistanceTo(m_myWorld.getBall().getAbsPositionOfNextRound())-MINDISTTOBALL
-(m_myWorld.getSenseBodyInfo().m_amountOfSpeed ));
}
--- 135,143 ----
case 1:
// Is Ball moving?
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
{
// Position of the ball when finally kicking
l_posDiff=m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
! l_dashPwr= edp2pwr(m_myWorld.getMyDistanceTo(m_myWorld.getBall().getAbsPositionOfNextRound())-MINDISTTOBALL
-(m_myWorld.getSenseBodyInfo().m_amountOfSpeed ));
}
***************
*** 140,146 ****
{
//Ball is not moving, but maybe myself
! l_dashPwr= edp2pwr( m_myWorld.getMyself().getDistanceTo( m_myWorld.getBall().getAbsPosition()) -MINDISTTOBALL
! -(m_myWorld.getSenseBodyInfo().m_amountOfSpeed
! ));
}
--- 145,151 ----
{
//Ball is not moving, but maybe myself
! l_dashPwr= edp2pwr( m_myWorld.getMyDistanceTo( m_myWorld.getBall().getAbsPosition()) -MINDISTTOBALL
! -m_myWorld.getSenseBodyInfo().m_amountOfSpeed
! );
}
***************
*** 148,152 ****
m_actionList.add(m_actionList.size(),new Action(DASH,l_dashPwr , 0));
m_actionList.add(m_actionList.size(),new Action(KICK, f_power, l_kickDir ));
- // nop();
break;
/* case 2:
--- 153,156 ----
***************
*** 154,158 ****
// Is Ball moving?
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null) {
! // Position of the ball when finally kicking
l_posDiff=m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
l_posOfBallOverOverNextRound=m_myWorld.getBall().getAbsPositionOfNextRound().
--- 158,162 ----
// Is Ball moving?
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null) {
! // Position of the ball when finally kicking
l_posDiff=m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
l_posOfBallOverOverNextRound=m_myWorld.getBall().getAbsPositionOfNextRound().
***************
*** 160,173 ****
add(l_posDiff.scaleWith(ServerConf.BALL_DECAY*ServerConf.BALL_DECAY));
! // Direction of the ball when finally kicking
l_turnedDirection=m_myWorld.getBodyDirectionTo(l_posOfBallOverOverNextRound);
! // Moment of the ball when finally kicking
l_moment= l_turnedDirection * moment();
l_dashPwr= edp2pwr(m_myWorld.getMyself().getDistanceTo(l_posOfBallOverOverNextRound)-MINDISTTOBALL
-(m_myWorld.getSenseBodyInfo().m_amountOfSpeed
! *Math.pow(ServerConf.PLAYER_DECAY,3)));
}
else{
! //Ball is not moving, but maybe myself
l_turnedDirection=m_myWorld.getBodyDirectionTo( m_myWorld.getBall());
l_moment= l_turnedDirection * moment();
--- 164,177 ----
add(l_posDiff.scaleWith(ServerConf.BALL_DECAY*ServerConf.BALL_DECAY));
! // Direction of the ball when finally kicking
l_turnedDirection=m_myWorld.getBodyDirectionTo(l_posOfBallOverOverNextRound);
! // Moment of the ball when finally kicking
l_moment= l_turnedDirection * moment();
l_dashPwr= edp2pwr(m_myWorld.getMyself().getDistanceTo(l_posOfBallOverOverNextRound)-MINDISTTOBALL
-(m_myWorld.getSenseBodyInfo().m_amountOfSpeed
! *Math.pow(ServerConf.PLAYER_DECAY,3)));
}
else{
! //Ball is not moving, but maybe myself
l_turnedDirection=m_myWorld.getBodyDirectionTo( m_myWorld.getBall());
l_moment= l_turnedDirection * moment();
***************
*** 214,344 ****
public void performAction()
{
! if (!m_actionList.isEmpty())
{
! double l_actionAngle=0;
! switch(((Action)m_actionList.getFirst()).getActionType())
{
! case KICK:
! try
! {
! m_myCom.kick(( (Action) m_actionList.getFirst() ).getActionValue1(), ( (Action) m_actionList.getFirst() ).getActionValue2());
! //turn our head to where we kicked the ball to
! l_actionAngle=((Action)m_actionList.getFirst()).getActionValue2()/moment();
! }
! catch (xCommunication xCom)
! {
! logger.debug("Could not send kick action!"+xCom.getMessage());
! }
! // m_myWorld.informKick(( (Action) m_actionList.getFirst() ).getActionValue1(), l_actionAngle );
! break;
! case TURN:
! try
! {
! m_myCom.turn(((Action)m_actionList.getFirst()).getActionValue1());
! l_actionAngle=(((Action)m_actionList.getFirst()).getActionValue1() / moment());
// nop();
! }
! catch (xCommunication xCom)
! {
! logger.debug("Could not send turn action!"+xCom.getMessage());
! }
// m_myWorld.informTurn(l_actionAngle );
! break;
! case DASH:
! try
! {
! m_myCom.dash(((Action)m_actionList.getFirst()).getActionValue1());
! // m_myWorld.informDash(((Action)m_actionList.getFirst()).getActionValue1());
! if (m_myWorld.getBall().isVisible())
{
! /** @todo turn neck here, so we dont loose ball when dashing */
}
- }
- catch (xCommunication xCom)
- {
- logger.debug("Could not send dash action!"+xCom.getMessage());
- }
! // logger.warn(" --- DASH send to Server ---") ;
! break;
! case MOVE:
! try
! {
! m_myCom.move(((Action)m_actionList.getFirst()).getActionValue1(), ( (Action) m_actionList.getFirst() ).getActionValue2());
! }
! catch (xCommunication xCom)
! {
! logger.debug("Could not send move action!"+xCom.getMessage());
! }
! // m_myWorld.informMove(((Action)m_actionList.getFirst()).getActionValue1(), ( (Action) m_actionList.getFirst() ).getActionValue2());
! // logger.warn(" --- MOVE send to Server ---") ;
! break;
! case CATCHBALL:
! try
! {
! m_myCom.catchBall(m_myWorld.getBodyDirectionTo(m_myWorld.getBall()));
! // logger.warn(" --- CATCHBALL send to Server ---") ;
! }
! catch (xCommunication xCom)
! {
! logger.debug("Could not send catch ball action!"+xCom.getMessage());
! }
// m_myWorld.informCatchBall(m_myWorld.getBodyDirectionTo(m_myWorld.getBall()));
! break;
! case SAY:
! try
! {
! m_myCom.say(m_voiceMessage);
! // logger.warn(" --- SAY send to Server ---");
! }
! catch (xCommunication xCom)
! {
! logger.debug("Could not send say ball action!"+xCom.getMessage());
! }
! break;
! case NOP:
! break;
! default:
! logger.debug("Hier ist was schiefgelaufen :-( Actionmanager.java");
! }//switch
! int l_actionType=((Action)m_actionList.getFirst()).getActionType();
! if (l_actionType==ActionManager.DASH || l_actionType==ActionManager.KICK || l_actionType==ActionManager.TURN)
! {
! try
{
! if (m_visualUpdateHappened && m_myWorld.getBall().isVisible()) //on first step after new see event --> turn neck to ball
{
! double l_angleToBall=m_myWorld.getBall().getDirection();
! m_myCom.turnNeck(l_angleToBall-l_actionAngle);
// m_myWorld.informTurnNeck(l_angleToBall-l_actionAngle);
! m_visualUpdateHappened=false;
! }
! else if (m_myWorld.getBall().isVisible())
! {
! m_myCom.turnNeck(l_actionAngle);
// m_myWorld.informTurnNeck(l_actionAngle);
}
! else
{
! m_myCom.turnNeck(-m_myWorld.getNeckDirection());
! // m_myWorld.informTurnNeck(-m_myWorld.getNeckDirection());
}
}
! catch (xCommunication ex)
! {
! logger.debug("Caugght ex from Communication"+ex.getMessage());
! }
}
- m_actionList.remove(0);
- }
- else //action list is empty
- {
}
}//performAction
--- 218,361 ----
public void performAction()
{
! Action l_currentAction;
! synchronized (m_actionList)
{
! if (!m_actionList.isEmpty())
{
! double l_actionAngle=0;
! l_currentAction=(Action)m_actionList.getFirst();
! switch(l_currentAction.getActionType())
! {
! case KICK:
! try
! {
! m_myCom.kick(l_currentAction.getActionValue1(), l_currentAction.getActionValue2());
! //turn our head to where we kicked the ball to
! l_actionAngle=l_currentAction.getActionValue2()/moment();
! }
! catch (xCommunication xCom)
! {
! logger.debug("Could not send kick action!"+xCom.getMessage());
! }
! // m_myWorld.informKick(l_currentAction.getActionValue1(), l_actionAngle );
! break;
! case TURN:
! try
! {
! m_myCom.turn(l_currentAction.getActionValue1());
! l_actionAngle=(l_currentAction.getActionValue1() / moment());
// nop();
! }
! catch (xCommunication xCom)
! {
! logger.debug("Could not send turn action!"+xCom.getMessage());
! }
// m_myWorld.informTurn(l_actionAngle );
! break;
! case DASH:
! try
{
! m_myCom.dash(l_currentAction.getActionValue1());
! // m_myWorld.informDash(l_currentAction.getActionValue1());
! if (m_myWorld.getBall().isVisible())
! {
! /** @todo turn neck here, so we dont loose ball when dashing */
! }
! }
! catch (xCommunication xCom)
! {
! logger.debug("Could not send dash action!"+xCom.getMessage());
}
! // logger.warn(" --- DASH send to Server ---") ;
! break;
! case MOVE:
! try
! {
! m_myCom.move(l_currentAction.getActionValue1(), l_currentAction.getActionValue2());
! }
! catch (xCommunication xCom)
! {
! logger.debug("Could not send move action!"+xCom.getMessage());
! }
! // m_myWorld.informMove(l_currentAction.getActionValue1(), l_currentAction.getActionValue2());
! // logger.warn(" --- MOVE send to Server ---") ;
! break;
! case CATCHBALL:
! try
! {
! m_myCom.catchBall(l_currentAction.getActionValue1());
! // logger.warn(" --- CATCHBALL send to Server ---") ;
! }
! catch (xCommunication xCom)
! {
! logger.debug("Could not send catch ball action!"+xCom.getMessage());
! }
// m_myWorld.informCatchBall(m_myWorld.getBodyDirectionTo(m_myWorld.getBall()));
! break;
! case SAY:
! try
! {
! m_myCom.say(m_voiceMessage);
! // logger.warn(" --- SAY send to Server ---");
! }
! catch (xCommunication xCom)
! {
! logger.debug("Could not send say ball action!"+xCom.getMessage());
! }
! break;
! case NOP:
! break;
! default:
! logger.debug("Hier ist was schiefgelaufen :-( Actionmanager.java");
! }//switch
! int l_actionType=l_currentAction.getActionType();
! if (l_actionType==ActionManager.DASH || l_actionType==ActionManager.KICK || l_actionType==ActionManager.TURN)
{
! try
{
! if (m_visualUpdateHappened && m_myWorld.getBall().isVisible()) //on first step after new see event --> turn neck to ball
! {
! double l_angleToTurnNeck=m_myWorld.getBall().getDirection()-l_actionAngle;
! if (Math.abs(l_angleToTurnNeck+m_myWorld.getNeckDirection())>90) //dont break ya neck
! {
! changeView(++m_myState.m_currentViewWidth,true);
! }
! m_myCom.turnNeck(l_angleToTurnNeck);
// m_myWorld.informTurnNeck(l_angleToBall-l_actionAngle);
! m_visualUpdateHappened=false;
! }
! else if(m_myState.m_searchingBall)
! {
! m_myCom.turnNeck(-m_myWorld.getNeckDirection());
! // m_myWorld.informTurnNeck(-m_myWorld.getNeckDirection());
! }
! else
! {
! m_myCom.turnNeck(l_actionAngle);
! if (Math.abs(l_actionAngle+m_myWorld.getNeckDirection())>90) //dont break ya neck
! {
! changeView(++m_myState.m_currentViewWidth,true);
! }
// m_myWorld.informTurnNeck(l_actionAngle);
+ }
}
! catch (xCommunication ex)
{
! logger.debug("Caugght ex from Communication"+ex.getMessage());
}
}
! m_actionList.remove(0);
! }
! else //action list is empty
! {
}
}
}//performAction
***************
*** 353,358 ****
{
m_actionList.add(m_actionList.size(),new Action(DASH, f_power, 0));
- // nop();
- // nop();
}
--- 370,373 ----
***************
*** 371,393 ****
double l_percentageOfPower=f_power/100;
boolean l_turnHappened=false;
! // Rückwarts rennen
! // if (runAback(f_position)) {
! // f_power = -f_power;
! // l_correctedPower = -l_correctedPower;
! // if (l_deltaAngle > 0)
! // l_deltaAngle -= 180;
! // else
! // l_deltaAngle += 180;
! // }
- // Muss ich mich zum Ball drehen?
- // JA
if(Math.abs(l_deltaAngle)>TOLERANCEANGLE)
{
! m_actionList.add(new Action(TURN,l_moment,0));
l_turnHappened=true;
}
- // logger.fatal("running to ball (turned)?" + l_turnHappened +" cycles "+ f_cycles +" moment "+ l_moment + " l_deltaAngle " +l_deltaAngle );
- // logger.fatal("absbodydirtoball"+m_myWorld.getBodyDirectionTo(m_myWorld.getBall()));
switch(f_cycles)
{
--- 386,403 ----
double l_percentageOfPower=f_power/100;
boolean l_turnHappened=false;
! // Rückwarts rennen
! // if (runAback(f_position)) {
! // f_power = -f_power;
! // if (l_deltaAngle > 0)
! // l_deltaAngle -= 180;
! // else
! // l_deltaAngle += 180;
! // }
if(Math.abs(l_deltaAngle)>TOLERANCEANGLE)
{
! m_actionList.add(m_actionList.size(),new Action(TURN,l_moment,0));
l_turnHappened=true;
}
switch(f_cycles)
{
***************
*** 395,409 ****
if (!l_turnHappened)
{
! l_power=edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2-m_myWorld.getSenseBodyInfo().m_amountOfSpeed));
! m_actionList.add(new Action(DASH,Math.min(100,l_power),0));
}
break;
case SenseBodyInfo.NORMAL:
if(l_turnHappened)
! m_actionList.add(new Action(DASH,f_power,0));
else
{
! m_actionList.add(new Action(DASH,f_power,0));
! m_actionList.add(new Action(DASH,f_power,0));
}
break;
--- 405,426 ----
if (!l_turnHappened)
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position) - ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
! // logger.fatal("narrow dash sent"+Math.min(100,l_power));
! m_actionList.add(m_actionList.size(),new Action(DASH,Math.min(100,l_power),0));
}
break;
case SenseBodyInfo.NORMAL:
if(l_turnHappened)
! {
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position) - ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
! // logger.fatal("normal dash sent(with turn)"+Math.min(l_power,100));
! m_actionList.add(m_actionList.size(),new Action(DASH,Math.min(100,l_power),0));
! }
else
{
! l_power=l_percentageOfPower*edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2)-m_myWorld.getSenseBodyInfo().m_amountOfSpeed);
! // logger.fatal("normal dash sent(wo turn)"+Math.min(100,l_power));
! m_actionList.add(m_actionList.size(),new Action(DASH,Math.min(100,l_power),0));
! m_actionList.add(m_actionList.size(),new Action(DASH,Math.min(100,l_power),0));
}
break;
***************
*** 411,422 ****
if(!l_turnHappened)
{
! m_actionList.add(new Action(DASH,f_power,0));
! m_actionList.add(new Action(DASH,f_power,0));
! m_actionList.add(new Action(DASH,f_power,0));
}
else
{
! m_actionList.add(new Action(DASH,f_power,0));
! m_actionList.add(new Action(DASH,f_power,0));
}
break;
--- 428,439 ----
if(!l_turnHappened)
{
! m_actionList.add(m_actionList.size(),new Action(DASH,f_power,0));
! m_actionList.add(m_actionList.size(),new Action(DASH,f_power,0));
! m_actionList.add(m_actionList.size(),new Action(DASH,f_power,0));
}
else
{
! m_actionList.add(m_actionList.size(),new Action(DASH,f_power,0));
! m_actionList.add(m_actionList.size(),new Action(DASH,f_power,0));
}
break;
***************
*** 426,431 ****
}
-
-
/**
* Wrapper for runTo with an ObjectInfo
--- 443,446 ----
***************
*** 448,455 ****
public void turn(double f_angle)
{
! m_actionList.add(m_actionList.size(),new Action(TURN, f_angle*moment(), -100));
! // nop();
! // nop();
! //m_myState.IncActionCounter();
}
--- 463,467 ----
public void turn(double f_angle)
{
! m_actionList.add(m_actionList.size(),new Action(TURN, f_angle*moment(),0));
}
***************
*** 466,471 ****
l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
m_actionList.add(m_actionList.size(),new Action(CATCHBALL, l_deltaAngle, 0));
- // nop();
- // nop();
break;
case 1:
--- 478,481 ----
***************
*** 473,477 ****
nop();
m_actionList.add(m_actionList.size(),new Action(CATCHBALL, l_deltaAngle, 0));
- // nop();
break;
case 2:
--- 483,486 ----
***************
*** 523,527 ****
public void flush()
{
! m_actionList.clear();
}
--- 532,539 ----
public void flush()
{
! synchronized (m_actionList)
! {
! m_actionList.clear();
! }
}
***************
*** 533,537 ****
public boolean listEmpty()
{
! return (m_actionList.isEmpty());
}
--- 545,552 ----
public boolean listEmpty()
{
! synchronized (m_actionList)
! {
! return (m_actionList.isEmpty());
! }
}
***************
*** 659,663 ****
try
{
! sleep(80);
performAction();
// logger.fatal("action performed"+System.currentTimeMillis());
--- 674,678 ----
try
{
! sleep(90);
performAction();
// logger.fatal("action performed"+System.currentTimeMillis());
***************
*** 675,679 ****
while (m_threadSuspended && l_thisThread==m_performerThread) //check again if we should sleep,
{
- //logger.info("\t" + getName() + ": Going to wait now for something new");
wait(); // this command lets our thread sleep until we wake him up
}
--- 690,693 ----
***************
*** 685,689 ****
}
}//of while()
- //logger.info("\t" + getName() + ": i've left my while-loop. run() will stop immediatly
}
--- 699,702 ----
|
|
From: <mae...@us...> - 2002-07-14 22:56:43
|
Update of /cvsroot/jais/jaisteam/src/jais/world
In directory usw-pr-cvs1:/tmp/cvs-serv30379/world
Modified Files:
WorldModel.java WorldDataAccessInterface.java
Log Message:
viewmodes added & more
checkgoalkick new progged by bombenleger
...
many bugs....
Index: WorldModel.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/world/WorldModel.java,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -d -r1.58 -r1.59
*** WorldModel.java 14 Jul 2002 14:01:23 -0000 1.58
--- WorldModel.java 14 Jul 2002 22:56:40 -0000 1.59
***************
*** 51,54 ****
--- 51,57 ----
private double m_absBodyDir;
+ private boolean m_aPlayerIsBehind;
+ private boolean m_ballIsBehind;
+
/**
* Constructor initializes the member variables.
***************
*** 150,163 ****
public SenseBodyInfo getSenseBodyInfo()
{
! try
! {
! return(SenseBodyInfo)m_senseBodyInfos.getLast();
! }
! catch (Exception ex)
! {
! while(m_senseBodyInfos.isEmpty())
! { } //wait until we have an object
! return(SenseBodyInfo)m_senseBodyInfos.getLast();
! }
}
--- 153,166 ----
public SenseBodyInfo getSenseBodyInfo()
{
! try
! {
! return(SenseBodyInfo)m_senseBodyInfos.getLast();
! }
! catch (Exception ex)
! {
! while(m_senseBodyInfos.isEmpty())
! { } //wait until we have an object
! return(SenseBodyInfo)m_senseBodyInfos.getLast();
! }
}
***************
*** 230,234 ****
--- 233,245 ----
}
+ public boolean isPlayerBehind()
+ {
+ return m_aPlayerIsBehind;
+ }
+ public boolean isBallBehind()
+ {
+ return m_ballIsBehind;
+ }
/****************************************************************************************/
***************
*** 262,267 ****
public synchronized void updateVisualInfo(VisualEvent f_visualEvent)
{
- jais.utils.Timer l_timer=new jais.utils.Timer();
- l_timer.Start();
logger.info("updating my Visual Info and calculating absolute positions now");
ArrayList l_visualInfos=f_visualEvent.getObjects();
--- 273,276 ----
***************
*** 272,275 ****
--- 281,287 ----
m_currentlySeenLines=new LinkedList();
m_ball.setVisible(false);
+ m_ballIsBehind=false;
+ m_aPlayerIsBehind=false;
+
//store the objects in this visual event in the correct list
for(ListIterator it=l_visualInfos.listIterator();it.hasNext();)
***************
*** 285,288 ****
--- 297,302 ----
if (!l_objectInfo.isBehind())
m_currentlySeenPlayers.addLast(l_objectInfo);
+ else
+ m_aPlayerIsBehind=true;
}
else if (l_objectInfo instanceof BallInfo) //if we see the ball, store it
***************
*** 294,297 ****
--- 308,313 ----
m_ball.setVisible(true);
}
+ else
+ m_ballIsBehind=true;
}
else if (l_objectInfo instanceof GoalInfo) // store the goal(s)
***************
*** 311,315 ****
updateAbsolutePositions();
updatePlayerLists();
- logger.info("updating visual info lasted: "+l_timer.GetTime());
}
--- 327,330 ----
Index: WorldDataAccessInterface.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/world/WorldDataAccessInterface.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** WorldDataAccessInterface.java 14 Jul 2002 14:01:23 -0000 1.10
--- WorldDataAccessInterface.java 14 Jul 2002 22:56:40 -0000 1.11
***************
*** 174,176 ****
--- 174,188 ----
*/
public LinkedList getCurrentylSeenGoals();
+
+ /**
+ * This method checks if any player is behind me (as then it is not in the lists)
+ * @return true if a player is behind me, otherwise false
+ */
+ public boolean isPlayerBehind();
+
+ /**
+ * This method checks the ball is behind me (as then it is not visible)
+ * @return true if ball is behind me, otherwise false
+ */
+ public boolean isBallBehind();
}
|
|
From: <mae...@us...> - 2002-07-14 22:56:43
|
Update of /cvsroot/jais/jaisteam/src/jais In directory usw-pr-cvs1:/tmp/cvs-serv30379 Modified Files: JaisTeam.java Jais.java Log Message: viewmodes added & more checkgoalkick new progged by bombenleger ... many bugs.... Index: JaisTeam.java =================================================================== RCS file: /cvsroot/jais/jaisteam/src/jais/JaisTeam.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** JaisTeam.java 13 Jul 2002 16:21:50 -0000 1.15 --- JaisTeam.java 14 Jul 2002 22:56:40 -0000 1.16 *************** *** 8,11 **** --- 8,12 ---- import jais.utils.*; import jais.world.WorldModel; + import java.io.*; /** *************** *** 22,26 **** private boolean m_commandLineReading = true; // indicate when we have to stop, or not start to read from commandline private static Logger logger; // logger from the apache project ! /** * Constructor starts up f_numberOfPlayers and begins reading from commandline --- 23,27 ---- private boolean m_commandLineReading = true; // indicate when we have to stop, or not start to read from commandline private static Logger logger; // logger from the apache project ! private BufferedReader m_input; /** * Constructor starts up f_numberOfPlayers and begins reading from commandline *************** *** 43,52 **** if (m_numberOfPlayers>1)//if we should connect more than one player, we connect a goalie as first player { ! m_playerList.add(new Jais(f_teamName,f_serverName,f_serverPort,true,1,false)); l_connectedPlayers++; } for (int i=l_connectedPlayers; i<m_numberOfPlayers; i++) { // create the rest of the team here ! m_playerList.add(new Jais(f_teamName,f_serverName,f_serverPort,false,i+1,false)); } } --- 44,53 ---- if (m_numberOfPlayers>1)//if we should connect more than one player, we connect a goalie as first player { ! m_playerList.add(new Jais(this, f_teamName,f_serverName,f_serverPort,true,1,false)); l_connectedPlayers++; } for (int i=l_connectedPlayers; i<m_numberOfPlayers; i++) { // create the rest of the team here ! m_playerList.add(new Jais(this, f_teamName,f_serverName,f_serverPort,false,i+1,false)); } } *************** *** 154,157 **** --- 155,171 ---- /** + * This method is called by the communication if it thinks, there is no more server present + * @param f_timesWaited how many times it retried to receive stuff + */ + public void informClientDisconnected() + { + m_numberOfPlayers--; + if (m_numberOfPlayers==0) + { + m_commandLineReading=false; + System.out.println("All Players disconnected ... hit RETURN to quit"); + } + } + /** * This method reads all commandline parameters which are typed in while the game * is running and passes them to the corresponding player *************** *** 160,164 **** private void readFromCommandline() { ! BufferedReader l_input = new BufferedReader(new InputStreamReader(System.in)); String l_message= new String(); String l_tempString= new String(); --- 174,178 ---- private void readFromCommandline() { ! m_input = new BufferedReader(new InputStreamReader(System.in)); String l_message= new String(); String l_tempString= new String(); *************** *** 168,172 **** System.out.print("\nType help for help \n>"); try ! { l_message=l_input.readLine(); } catch (Exception ex) { --- 182,186 ---- System.out.print("\nType help for help \n>"); try ! { l_message=m_input.readLine(); } catch (Exception ex) { Index: Jais.java =================================================================== RCS file: /cvsroot/jais/jaisteam/src/jais/Jais.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Jais.java 13 Jul 2002 16:21:50 -0000 1.28 --- Jais.java 14 Jul 2002 22:56:40 -0000 1.29 *************** *** 27,30 **** --- 27,31 ---- static Logger logger=Logger.getLogger("jais"); + JaisTeam m_jaisTeam; //reference on our creator if present WorldModel m_worldModel; Visualization m_visualization; *************** *** 40,44 **** boolean m_commandLineReading=true; boolean m_singleMode=false; ! /** * @param f_teamName name of our team --- 41,45 ---- boolean m_commandLineReading=true; boolean m_singleMode=false; ! BufferedReader m_inputReader; //needed for reading from commandline if in singlemode /** * @param f_teamName name of our team *************** *** 52,57 **** * @roseuid 3CE6898C0366 */ ! public Jais(String f_teamName, String f_serverName, int f_serverPort, boolean f_isGoalie,int f_playerNumber, boolean f_singleMode) throws xJais { this.setName("Jais"+f_playerNumber); m_teamName=f_teamName; //store our Teamname --- 53,59 ---- * @roseuid 3CE6898C0366 */ ! public Jais(JaisTeam f_jaisTeam, String f_teamName, String f_serverName, int f_serverPort, boolean f_isGoalie,int f_playerNumber, boolean f_singleMode) throws xJais { + m_jaisTeam=f_jaisTeam; this.setName("Jais"+f_playerNumber); m_teamName=f_teamName; //store our Teamname *************** *** 113,116 **** --- 115,124 ---- { logger.fatal("Jais #"+m_playerNumber +" says bye...lost conn to server"); + if (!m_singleMode) + m_jaisTeam.informClientDisconnected(); + else + { + System.out.println("... hit RETURN to quit"); + } this.quit(); } *************** *** 123,132 **** public static void main(String[] args) { ! FileAppender fa = new FileAppender(); ! fa.setFile("jais.txt"); ! fa.setLayout(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN)); ! fa.setAppend(false); ! fa.activateOptions(); ! logger.addAppender(fa); BasicConfigurator.configure(); --- 131,140 ---- public static void main(String[] args) { ! FileAppender l_fa = new FileAppender(); ! l_fa.setFile("jais.txt"); ! l_fa.setLayout(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN)); ! l_fa.setAppend(false); ! l_fa.activateOptions(); ! logger.addAppender(l_fa); BasicConfigurator.configure(); *************** *** 144,154 **** try { ! player=new Jais((String)l_args.get("Teamname"), (String)l_args.get("Servername"), Integer.parseInt((String)l_args.get("Serverport")), ((Boolean)l_args.get("g")).booleanValue(), 0, ! true ! ); } catch(xJais ex) { --- 152,161 ---- try { ! player=new Jais(null, (String)l_args.get("Teamname"), (String)l_args.get("Servername"), Integer.parseInt((String)l_args.get("Serverport")), ((Boolean)l_args.get("g")).booleanValue(), 0, ! true); } catch(xJais ex) { *************** *** 481,485 **** private void readFromCommandline() { ! BufferedReader l_input = new BufferedReader(new InputStreamReader(System.in)); String l_message= new String(); while(m_commandLineReading) --- 488,492 ---- private void readFromCommandline() { ! m_inputReader = new BufferedReader(new InputStreamReader(System.in)); String l_message= new String(); while(m_commandLineReading) *************** *** 488,492 **** try { ! l_message=l_input.readLine(); } --- 495,499 ---- try { ! l_message=m_inputReader.readLine(); } |
|
From: <mae...@us...> - 2002-07-14 14:01:26
|
Update of /cvsroot/jais/jaisteam/src/jais/player
In directory usw-pr-cvs1:/tmp/cvs-serv4108/player
Modified Files:
KI.java ActionManager.java
Log Message:
change viewModes not ready yet, but massively improved
added a new thread, an actionPerformer .... this is needed as
of timing issues
Index: KI.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/KI.java,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -d -r1.77 -r1.78
*** KI.java 13 Jul 2002 20:29:24 -0000 1.77
--- KI.java 14 Jul 2002 14:01:23 -0000 1.78
***************
*** 31,42 ****
! private final Coordinate[][] HOMEPOS = {{new Coordinate(0,0), new Coordinate(-50,0),
! /*defense */ new Coordinate(-35,20), new Coordinate(-40,7), new Coordinate(-40,-7),new Coordinate(-35,-20),
! /*midfield*/ new Coordinate(-20,10), new Coordinate(-20,0), new Coordinate(-20,-10),
! /*attackers*/ new Coordinate(-5,15), new Coordinate(-10,0), new Coordinate(-5,-15)},
! /*goalie*/ {new Coordinate(0,0), new Coordinate(-50,0),
! /*defense*/ new Coordinate(-25,20), new Coordinate(-30,7), new Coordinate(-30,-7),new Coordinate(-25,-20),
! /*midfield*/ new Coordinate(0,10), new Coordinate(0,0), new Coordinate(0,-10),
! /*attackers*/ new Coordinate(20,20), new Coordinate(30,0), new Coordinate(20,-20)}};
private final Coordinate GOALIE_HOME_POS = new Coordinate(-50, 0);
--- 31,39 ----
! private final Coordinate[] HOMEPOS = {
! /*goalie*/ new Coordinate(0,0), new Coordinate(-50,0),
! /*defense*/ new Coordinate(-25,20), new Coordinate(-30,7), new Coordinate(-30,-7),new Coordinate(-25,-20),
! /*midfield*/ new Coordinate(0,10), new Coordinate(0,0), new Coordinate(0,-10),
! /*attackers*/ new Coordinate(30,15), new Coordinate(25,0), new Coordinate(30,-15)};
private final Coordinate GOALIE_HOME_POS = new Coordinate(-50, 0);
***************
*** 76,80 ****
this.setName("KI"+f_playerNumber);
m_myWorld = f_world;
! m_actions = new ActionManager(m_myWorld, f_myCom);
m_myState = new StateManager();
}
--- 73,77 ----
this.setName("KI"+f_playerNumber);
m_myWorld = f_world;
! m_actions = new ActionManager(m_myWorld, f_myCom, f_playerNumber);
m_myState = new StateManager();
}
***************
*** 91,111 ****
while(l_thisThread==m_KIThread)
{
! if (m_actions.listEmpty()) //If action list isn't empty, we don't have to look for a new decision
{
! try
! {
! m_actions.InformVisualUpdateHappened();
! m_enemyTeam=m_myWorld.getEnemyPlayers();
! m_ownTeam=m_myWorld.getFriendlyPlayers();
! root(); //Start our tree in the root
! }
! catch (Exception ex)
! {
! logger.debug("Caught Execption from root in KI"+ex.getMessage());
! ex.printStackTrace();
! logger.debug("Report this to jai...@li.... KI is still Working!");
! }
}
-
m_threadSuspended=true; //we want to suspend ourself after one run
try
--- 88,106 ----
while(l_thisThread==m_KIThread)
{
! //ok, we were waked up, so theres new information avaiable. discard last actions and decide new
! m_actions.flush();
! try
{
! m_actions.InformVisualUpdateHappened();
! m_enemyTeam=m_myWorld.getEnemyPlayers();
! m_ownTeam=m_myWorld.getFriendlyPlayers();
! root(); //Start our tree in the root
! }
! catch (Exception ex)
! {
! logger.debug("Caught Execption from root in KI"+ex.getMessage());
! ex.printStackTrace();
! logger.debug("Report this to jai...@li.... KI is still Working!");
}
m_threadSuspended=true; //we want to suspend ourself after one run
try
***************
*** 134,138 ****
public void onSenseBody()
{
! m_actions.performAction(); //perform the next skill in our "Aktion-List"
}
--- 129,133 ----
public void onSenseBody()
{
! m_actions.activatePerformCounter(); //perform the next skill in our "Aktion-List"
}
***************
*** 214,230 ****
if ((m_myWorld.isPlayingLeft()&& f_forLeftSide) || (!m_myWorld.isPlayingLeft()&& !f_forLeftSide )){
! if ( HOMEPOS[1][m_myWorld.getMyself().getBackNumber()].getX() < 0)
! l_tempCoord.setX(HOMEPOS[1][m_myWorld.getMyself().getBackNumber()].getX());
else l_tempCoord.setX(-5);
! l_tempCoord.setY(HOMEPOS[1][m_myWorld.getMyself().getBackNumber()].getY());
}
else{
! if ( HOMEPOS[1][m_myWorld.getMyself().getBackNumber()].getX() < 0)
! l_tempCoord.setX(HOMEPOS[1][m_myWorld.getMyself().getBackNumber()].getX());
! else if ( Math.abs(HOMEPOS[1][m_myWorld.getMyself().getBackNumber()].getY()) < 11)
l_tempCoord.setX(-10);
else
l_tempCoord.setX(-5);
! l_tempCoord.setY(HOMEPOS[1][m_myWorld.getMyself().getBackNumber()].getY());
}
--- 209,225 ----
if ((m_myWorld.isPlayingLeft()&& f_forLeftSide) || (!m_myWorld.isPlayingLeft()&& !f_forLeftSide )){
! if ( HOMEPOS[m_myWorld.getMyself().getBackNumber()].getX() < 0)
! l_tempCoord.setX(HOMEPOS[m_myWorld.getMyself().getBackNumber()].getX());
else l_tempCoord.setX(-5);
! l_tempCoord.setY(HOMEPOS[m_myWorld.getMyself().getBackNumber()].getY());
}
else{
! if ( HOMEPOS[m_myWorld.getMyself().getBackNumber()].getX() < 0)
! l_tempCoord.setX(HOMEPOS[m_myWorld.getMyself().getBackNumber()].getX());
! else if ( Math.abs(HOMEPOS[m_myWorld.getMyself().getBackNumber()].getY()) < 11)
l_tempCoord.setX(-10);
else
l_tempCoord.setX(-5);
! l_tempCoord.setY(HOMEPOS[m_myWorld.getMyself().getBackNumber()].getY());
}
***************
*** 254,260 ****
else if (nearestToTheBall()){
if(m_myWorld.getBall().isBallKickableBy(m_myWorld.getMyself()))
! m_actions.kickTo(MAXPOWER,ENEMY_GOAL_POS,2); // schön ausrichten und voll draufhauen
else
! m_actions.runTo(NORMPOWER,m_myWorld.getBall());
}
}
--- 249,255 ----
else if (nearestToTheBall()){
if(m_myWorld.getBall().isBallKickableBy(m_myWorld.getMyself()))
! m_actions.kickTo(MAXPOWER,ENEMY_GOAL_POS,0); // schön ausrichten und voll draufhauen
else
! m_actions.runTo(NORMPOWER,m_myWorld.getBall(), m_myState.m_currentViewMode);
}
}
***************
*** 297,307 ****
l_tempPlayer =checkForPassPartner(10);
if (l_tempPlayer != null)
! passTo(l_tempPlayer,2);
else
! kickTo(ENEMY_GOAL_POS,2);
}
else
{
! m_actions.runTo(MINPOWER, m_myWorld.getBall());
}
}
--- 292,302 ----
l_tempPlayer =checkForPassPartner(10);
if (l_tempPlayer != null)
! passTo(l_tempPlayer,0);
else
! kickTo(ENEMY_GOAL_POS,0);
}
else
{
! m_actions.runTo(MINPOWER, m_myWorld.getBall(), m_myState.m_currentViewMode);
}
}
***************
*** 336,346 ****
l_tempPlayer =checkForPassPartner(10);
if (l_tempPlayer != null)
! passTo(l_tempPlayer,2);
else
! kickTo(ENEMY_GOAL_POS,2);
}
else
{
! m_actions.runTo(MAXPOWER, m_myWorld.getBall() );
}
--- 331,341 ----
l_tempPlayer =checkForPassPartner(10);
if (l_tempPlayer != null)
! passTo(l_tempPlayer,0);
else
! kickTo(ENEMY_GOAL_POS,0);
}
else
{
! m_actions.runTo(MAXPOWER, m_myWorld.getBall(), m_myState.m_currentViewMode);
}
***************
*** 393,405 ****
private void watchBall()
{
! m_actions.turn(m_myWorld.getBodyDirectionTo(m_myWorld.getBall()));
! /* if (Math.abs (m_myWorld.getSenseBodyInfo().getNeckDirection()) < 35 )
! m_actions.turnNeck(m_myWorld.getBall().getDirection());
! else
! {
! m_actions.turn(m_myWorld.getBodyDirectionTo(m_myWorld.getBall()));
! m_actions.turnNeck(-m_myWorld.getSenseBodyInfo().getNeckDirection());
! }
! */
}
--- 388,393 ----
private void watchBall()
{
! if (Math.abs(m_myWorld.getBodyDirectionTo(m_myWorld.getBall()))>0.2)
! m_actions.turn(m_myWorld.getBodyDirectionTo(m_myWorld.getBall()));
}
***************
*** 424,428 ****
while (l_zaehler < MAX_LOOKING_FORWARD_TIME )
{
! l_zaehler+=3;
l_nextDistance = m_myWorld.getMyself().getDistanceTo(getBallPosInRound(l_zaehler));
if (l_nextDistance < l_smallestDistance)
--- 412,416 ----
while (l_zaehler < MAX_LOOKING_FORWARD_TIME )
{
! l_zaehler+=m_myState.m_currentViewMode+1;
l_nextDistance = m_myWorld.getMyself().getDistanceTo(getBallPosInRound(l_zaehler));
if (l_nextDistance < l_smallestDistance)
***************
*** 442,446 ****
{
l_myTempPos=l_myTempPos.add(l_diffPos.scaleWith(3));
! l_zaehler+=3;
l_nextDistance = l_myTempPos.getDistanceTo(getBallPosInRound(l_zaehler));
if (l_nextDistance < l_smallestDistance)
--- 430,434 ----
{
l_myTempPos=l_myTempPos.add(l_diffPos.scaleWith(3));
! l_zaehler+=m_myState.m_currentViewMode+1;
l_nextDistance = l_myTempPos.getDistanceTo(getBallPosInRound(l_zaehler));
if (l_nextDistance < l_smallestDistance)
***************
*** 451,460 ****
}
}
! m_actions.runTo(MAXPOWER,getBallPosInRound(l_estimatedCyclesToReachTheBall));
}
// else if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
// m_actions.runTo(MAXPOWER,m_myWorld.getBall().getAbsPositionOfNextRound());
else //ball doesnt move so simply go to its position
! m_actions.runTo(MAXPOWER,m_myWorld.getBall());
}
--- 439,448 ----
}
}
! m_actions.runTo(MAXPOWER,getBallPosInRound(l_estimatedCyclesToReachTheBall), m_myState.m_currentViewMode);
}
// else if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
// m_actions.runTo(MAXPOWER,m_myWorld.getBall().getAbsPositionOfNextRound());
else //ball doesnt move so simply go to its position
! m_actions.runTo(MAXPOWER,m_myWorld.getBall(), m_myState.m_currentViewMode);
}
***************
*** 497,500 ****
--- 485,489 ----
int l_cycle=isBallKickableByMe();
if (l_cycle >= 0) //hab den ball
+ // if(m_myWorld.getBall().isVisible() && m_myWorld.getBall().isBallKickableBy(m_myWorld.getMyself()))
{
l_tempCoord = checkGoalKick();
***************
*** 574,578 ****
if(m_myWorld.getMyself().getAbsPosition().getX()>l_offsideBarrier-3)
{
! m_actions.runTo(NORMPOWER + 10, new Coordinate( l_offsideBarrier-8, HOMEPOS[1][m_myWorld.getMyself().getBackNumber()].getY()));
}
else if(atHomepos())
--- 563,567 ----
if(m_myWorld.getMyself().getAbsPosition().getX()>l_offsideBarrier-3)
{
! m_actions.runTo(NORMPOWER + 10, new Coordinate( l_offsideBarrier-8, HOMEPOS[m_myWorld.getMyself().getBackNumber()].getY()), m_myState.m_currentViewMode);
}
else if(atHomepos())
***************
*** 582,586 ****
if (m_myWorld.getSenseBodyInfo().m_stamina > 1000)
//m_actions.runTo (NORMPOWER + 10, HOMEPOS[m_myState.getState()][m_myWorld.getMyself().getBackNumber()]);
! m_actions.runTo (NORMPOWER + 10, HOMEPOS[1][m_myWorld.getMyself().getBackNumber()]);
}
}
--- 571,575 ----
if (m_myWorld.getSenseBodyInfo().m_stamina > 1000)
//m_actions.runTo (NORMPOWER + 10, HOMEPOS[m_myState.getState()][m_myWorld.getMyself().getBackNumber()]);
! m_actions.runTo(NORMPOWER + 10, HOMEPOS[m_myWorld.getMyself().getBackNumber()], m_myState.m_currentViewMode);
}
}
***************
*** 602,606 ****
l_runToPos.setY(MY_GOAL_POS.getY() + (-Math.sin(l_angleOfBall) * f_radius));
if (Math.abs(m_myWorld.getMyself().getDistanceTo(l_runToPos)) > 0.8)
! m_actions.runTo(MAXPOWER, l_runToPos);
else
watchBall();
--- 591,595 ----
l_runToPos.setY(MY_GOAL_POS.getY() + (-Math.sin(l_angleOfBall) * f_radius));
if (Math.abs(m_myWorld.getMyself().getDistanceTo(l_runToPos)) > 0.8)
! m_actions.runTo(MAXPOWER, l_runToPos, m_myState.m_currentViewMode);
else
watchBall();
***************
*** 613,617 ****
private void gotoEnemy(PlayerInfo f_player)
{
! m_actions.runTo(MAXPOWER, f_player.getAbsPosition());
}
--- 602,606 ----
private void gotoEnemy(PlayerInfo f_player)
{
! m_actions.runTo(MAXPOWER, f_player.getAbsPosition(), m_myState.m_currentViewMode);
}
***************
*** 963,967 ****
//if (m_myWorld.getMyself().getDistanceTo(HOMEPOS[m_myState.getState()][m_myWorld.getMyself().getBackNumber()]) > HOMERANGE_R)
! if (m_myWorld.getMyself().getDistanceTo(HOMEPOS[1][m_myWorld.getMyself().getBackNumber()]) > HOMERANGE_R)
return false;
else return true; //at homepos
--- 952,956 ----
//if (m_myWorld.getMyself().getDistanceTo(HOMEPOS[m_myState.getState()][m_myWorld.getMyself().getBackNumber()]) > HOMERANGE_R)
! if (m_myWorld.getMyself().getDistanceTo(HOMEPOS[m_myWorld.getMyself().getBackNumber()]) > HOMERANGE_R)
return false;
else return true; //at homepos
***************
*** 1065,1068 ****
--- 1054,1058 ----
m_KIThread=this;
m_KIThread.start();
+ m_actions.startActionPerformer();
}
***************
*** 1074,1077 ****
--- 1064,1068 ----
{
m_KIThread = null; //get a clean outcome
+ m_actions.stopActionPerformer();
notify();
}
***************
*** 1106,1146 ****
return 1;
}
- else if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null && m_myWorld.getMyself().getDistanceTo( getBallPosInRound(2)) < ServerConf.KICKABLE_MARGIN + (ServerConf.PLAYER_SIZE / 2 ) + (ServerConf.BALL_SIZE / 2))
- {
- // logger.debug("Pos in next: (2)" + m_myWorld.getBall().getAbsPositionOfNextRound());
- // logger.debug("dist to ball in next round"+m_myWorld.getMyself().getDistanceTo( getBallPosInRound(2)));
- return 2;
- }
- else
- {
- return -1;
- }
}
return -1;
}
private void manageViewMode()
{
if(!m_myWorld.getBall().isVisible())
{
! m_actions.changeView(SenseBodyInfo.WIDE,true);
! m_myState.m_currentViewMode=SenseBodyInfo.WIDE;
}
! else if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 5)
{
! m_actions.changeView(SenseBodyInfo.NARROW,true);
m_myState.m_currentViewMode=SenseBodyInfo.NARROW;
}
! else if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 20)
{
! m_actions.changeView(SenseBodyInfo.NORMAL,true);
m_myState.m_currentViewMode=SenseBodyInfo.NORMAL;
}
else
{
! m_actions.changeView(SenseBodyInfo.WIDE,true);
m_myState.m_currentViewMode=SenseBodyInfo.WIDE;
}
}
}
-
--- 1097,1144 ----
return 1;
}
}
return -1;
}
+ /**
+ * This method manages the viewMode of our Players.
+ * If the ball IS NOT visible it turns to normal mode, if it is not visible for a longer time, it turns to WIDE mode
+ * If the ball IS visible and distance is < 40 it turns to WIDE, else NORMAL , else to NARROW
+ */
private void manageViewMode()
{
if(!m_myWorld.getBall().isVisible())
{
! if (m_myWorld.sorry_whatTimeDoWeHave()-m_myWorld.getBall().getTime()>6)
! {
! if (m_myState.m_currentViewMode!=SenseBodyInfo.WIDE)
! m_actions.changeView(SenseBodyInfo.WIDE,true);
! m_myState.m_currentViewMode=SenseBodyInfo.WIDE;
! }
! else
! {
! if (m_myState.m_currentViewMode!=SenseBodyInfo.NORMAL)
! m_actions.changeView(SenseBodyInfo.NORMAL,true);
! m_myState.m_currentViewMode=SenseBodyInfo.NORMAL;
! }
}
! else if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 2)
{
! if (m_myState.m_currentViewMode!=SenseBodyInfo.NARROW)
! m_actions.changeView(SenseBodyInfo.NARROW,true);
m_myState.m_currentViewMode=SenseBodyInfo.NARROW;
}
! else if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 40)
{
! if (m_myState.m_currentViewMode!=SenseBodyInfo.NORMAL)
! m_actions.changeView(SenseBodyInfo.NORMAL,true);
m_myState.m_currentViewMode=SenseBodyInfo.NORMAL;
}
else
{
! if (m_myState.m_currentViewMode!=SenseBodyInfo.WIDE)
! m_actions.changeView(SenseBodyInfo.WIDE,true);
m_myState.m_currentViewMode=SenseBodyInfo.WIDE;
}
}
}
Index: ActionManager.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/ActionManager.java,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** ActionManager.java 13 Jul 2002 20:29:24 -0000 1.59
--- ActionManager.java 14 Jul 2002 14:01:23 -0000 1.60
***************
*** 17,21 ****
*/
! public class ActionManager
{
--- 17,21 ----
*/
! public class ActionManager extends Thread
{
***************
*** 23,29 ****
// Params for the RunTo-Method
! private final double SLOWDOWN =0.3;
! private final double TOLERANCEANGLE=4;
! private final double BREAKDISTANCE = 2;
// Params for the kickTo-Method
private final double MINDISTTOBALL=0.5;
--- 23,27 ----
// Params for the RunTo-Method
! private final double TOLERANCEANGLE=15;
// Params for the kickTo-Method
private final double MINDISTTOBALL=0.5;
***************
*** 49,53 ****
private static Logger logger=Logger.getLogger("jais.player");
!
/**
* Creates a new <code>ActionManager</code> instance.
--- 47,52 ----
private static Logger logger=Logger.getLogger("jais.player");
! private Thread m_performerThread;
! private boolean m_threadSuspended;
/**
* Creates a new <code>ActionManager</code> instance.
***************
*** 57,62 ****
* @roseuid 3CEB6AAA0062
*/
! public ActionManager(WorldModel f_myWorld, Communication f_myCom)
{
m_myWorld = f_myWorld;
m_myCom = f_myCom;
--- 56,62 ----
* @roseuid 3CEB6AAA0062
*/
! public ActionManager(WorldModel f_myWorld, Communication f_myCom, int f_playerNumber)
{
+ this.setName("ActionPerformer"+f_playerNumber);
m_myWorld = f_myWorld;
m_myCom = f_myCom;
***************
*** 77,95 ****
case 0:
// Ball ist nah genug zu kicken
! m_actionList.addLast(new Action(KICK, f_power * DRIBBELKICKPOWER ,
m_myWorld.getBodyDirectionTo(f_position)));
! m_actionList.addLast(new Action(TURN, m_myWorld.getBodyDirectionTo(f_position) , 0));
! m_actionList.addLast(new Action(DASH, f_power , 0));
break;
case 1:
nop();
! m_actionList.addLast(new Action(KICK, f_power * DRIBBELKICKPOWER ,
m_myWorld.getBodyDirectionTo(f_position)));
! m_actionList.addLast(new Action(TURN, m_myWorld.getBodyDirectionTo(f_position) , 0));
break;
case 2:
nop();
nop();
! m_actionList.addLast(new Action(KICK, f_power * DRIBBELKICKPOWER ,
m_myWorld.getBodyDirectionTo(f_position)));
break;
--- 77,95 ----
case 0:
// Ball ist nah genug zu kicken
! m_actionList.add(m_actionList.size(),new Action(KICK, f_power * DRIBBELKICKPOWER ,
m_myWorld.getBodyDirectionTo(f_position)));
! m_actionList.add(m_actionList.size(),new Action(TURN, m_myWorld.getBodyDirectionTo(f_position) , 0));
! m_actionList.add(m_actionList.size(),new Action(DASH, f_power , 0));
break;
case 1:
nop();
! m_actionList.add(m_actionList.size(),new Action(KICK, f_power * DRIBBELKICKPOWER ,
m_myWorld.getBodyDirectionTo(f_position)));
! m_actionList.add(m_actionList.size(),new Action(TURN, m_myWorld.getBodyDirectionTo(f_position) , 0));
break;
case 2:
nop();
nop();
! m_actionList.add(m_actionList.size(),new Action(KICK, f_power * DRIBBELKICKPOWER ,
m_myWorld.getBodyDirectionTo(f_position)));
break;
***************
*** 121,142 ****
double l_kickDir;
// logger.debug("cycle " + f_cycle);
! switch(f_cycle){
case 0:
l_kickDir=m_myWorld.getBodyDirectionTo(f_position);
! m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
! // nop();
! // nop();
break;
case 1:
// Is Ball moving?
! System.out.println("wanted to kick in 1 cycle");
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
{
// Position of the ball when finally kicking
l_posDiff=m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
! l_posOfBallOverNextRound=m_myWorld.getBall().getAbsPositionOfNextRound().add(l_posDiff.scaleWith(ServerConf.BALL_DECAY));
! l_dashPwr= edp2pwr(m_myWorld.getMyself().getDistanceTo(l_posOfBallOverNextRound)-MINDISTTOBALL
! -(m_myWorld.getSenseBodyInfo().m_amountOfSpeed
! *ServerConf.PLAYER_DECAY *ServerConf.PLAYER_DECAY ));
}
else
--- 121,139 ----
double l_kickDir;
// logger.debug("cycle " + f_cycle);
! switch(f_cycle)
! {
case 0:
l_kickDir=m_myWorld.getBodyDirectionTo(f_position);
! m_actionList.add(m_actionList.size(),new Action(KICK, f_power, l_kickDir ));
break;
case 1:
// Is Ball moving?
! System.out.println("wanted to kick in 1 cycle");
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
{
// Position of the ball when finally kicking
l_posDiff=m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
! l_dashPwr= edp2pwr(m_myWorld.getMyself().getDistanceTo(m_myWorld.getBall().getAbsPositionOfNextRound())-MINDISTTOBALL
! -(m_myWorld.getSenseBodyInfo().m_amountOfSpeed ));
}
else
***************
*** 145,158 ****
l_dashPwr= edp2pwr( m_myWorld.getMyself().getDistanceTo( m_myWorld.getBall().getAbsPosition()) -MINDISTTOBALL
-(m_myWorld.getSenseBodyInfo().m_amountOfSpeed
! *ServerConf.PLAYER_DECAY *ServerConf.PLAYER_DECAY ));
}
l_kickDir=m_myWorld.getBodyDirectionTo(f_position)- l_turnedDirection ;
! m_actionList.addLast(new Action(DASH,l_dashPwr , 0));
! m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
// nop();
break;
! case 2:
! System.out.println("wanted to kick in 2 cycle");
// Is Ball moving?
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null) {
--- 142,155 ----
l_dashPwr= edp2pwr( m_myWorld.getMyself().getDistanceTo( m_myWorld.getBall().getAbsPosition()) -MINDISTTOBALL
-(m_myWorld.getSenseBodyInfo().m_amountOfSpeed
! ));
}
l_kickDir=m_myWorld.getBodyDirectionTo(f_position)- l_turnedDirection ;
! m_actionList.add(m_actionList.size(),new Action(DASH,l_dashPwr , 0));
! m_actionList.add(m_actionList.size(),new Action(KICK, f_power, l_kickDir ));
// nop();
break;
! /* case 2:
! System.out.println("wanted to kick in 2 cycle");
// Is Ball moving?
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null) {
***************
*** 182,188 ****
//l_dashPwr=Math.max(0,l_dashPwr);
l_dashPwr=Math.min(100,l_dashPwr);
! m_actionList.addLast(new Action(TURN, l_moment, 0));
! m_actionList.addLast(new Action(DASH, l_dashPwr,0));
! m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
// logger.debug("Turn: " + l_moment + " DashPwr: " + l_dashPwr + " KickDir: " + l_kickDir );
--- 179,185 ----
//l_dashPwr=Math.max(0,l_dashPwr);
l_dashPwr=Math.min(100,l_dashPwr);
! m_actionList.add(m_actionList.size(),new Action(TURN, l_moment, 0));
! m_actionList.add(m_actionList.size(),new Action(DASH, l_dashPwr,0));
! m_actionList.add(m_actionList.size(),new Action(KICK, f_power, l_kickDir ));
// logger.debug("Turn: " + l_moment + " DashPwr: " + l_dashPwr + " KickDir: " + l_kickDir );
***************
*** 192,195 ****
--- 189,193 ----
default:
logger.debug("Hier hat jemand den falschen Cycle errechnet");
+ */
}
}
***************
*** 205,288 ****
public void kickTo(double f_power, ObjectInfo f_Object, int f_cycle)
{
! double l_turnedDirection=m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
! double l_moment= l_turnedDirection * moment();
! Coordinate l_posOfBallInNextRound=null;
! Coordinate l_posOfBallOverNextRound=null;
! Coordinate l_posOfBallOverOverNextRound=null;
! Coordinate l_posDiff=null;
! double l_dashPwr;
! double l_kickDir;
! // logger.debug("cycle " + f_cycle);
! switch(f_cycle){
! case 0:
! l_kickDir=m_myWorld.getBodyDirectionTo(f_Object );
! m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
! // nop();
! // nop();
! break;
! case 1:
! // Is Ball moving?
! System.out.println("wanted to kick in 1 cycle");
! if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
! {
! // Position of the ball when finally kicking
! l_posDiff=m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
! l_posOfBallOverNextRound=m_myWorld.getBall().getAbsPositionOfNextRound().add(l_posDiff.scaleWith(ServerConf.BALL_DECAY));
! l_dashPwr= edp2pwr(m_myWorld.getMyself().getDistanceTo(l_posOfBallOverNextRound)-MINDISTTOBALL
! -(m_myWorld.getSenseBodyInfo().m_amountOfSpeed
! *ServerConf.PLAYER_DECAY *ServerConf.PLAYER_DECAY ));
! }
! else
! {
! //Ball is not moving, but maybe myself
! l_dashPwr= edp2pwr( m_myWorld.getMyself().getDistanceTo( m_myWorld.getBall().getAbsPosition()) -MINDISTTOBALL
! -(m_myWorld.getSenseBodyInfo().m_amountOfSpeed
! *ServerConf.PLAYER_DECAY *ServerConf.PLAYER_DECAY ));
! }
! l_kickDir=m_myWorld.getBodyDirectionTo(f_Object )- l_turnedDirection ;
! m_actionList.addLast(new Action(DASH,l_dashPwr , 0));
! m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
! // nop();
! break;
! case 2:
! // Is Ball moving?
! System.out.println("wanted to kick in 2 cycle");
! if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null) {
! // Position of the ball when finally kicking
! l_posDiff=m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
! l_posOfBallOverOverNextRound=m_myWorld.getBall().getAbsPositionOfNextRound().
! add(l_posDiff.scaleWith(ServerConf.BALL_DECAY)).
! add(l_posDiff.scaleWith(ServerConf.BALL_DECAY*ServerConf.BALL_DECAY));
!
! // Direction of the ball when finally kicking
! l_turnedDirection=m_myWorld.getBodyDirectionTo(l_posOfBallOverOverNextRound);
! // Moment of the ball when finally kicking
! l_moment= l_turnedDirection * moment();
! l_dashPwr= edp2pwr(m_myWorld.getMyself().getDistanceTo(l_posOfBallOverOverNextRound)-MINDISTTOBALL
! -(m_myWorld.getSenseBodyInfo().m_amountOfSpeed
! *Math.pow(ServerConf.PLAYER_DECAY,3)));
! }
! else{
! //Ball is not moving, but maybe myself
! l_turnedDirection=m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
! l_moment= l_turnedDirection * moment();
! l_dashPwr= edp2pwr(m_myWorld.getBall().getDistance()-MINDISTTOBALL
! -(m_myWorld.getSenseBodyInfo().m_amountOfSpeed* Math.pow(ServerConf.PLAYER_DECAY,3)));
! }
!
! l_kickDir=m_myWorld.getBodyDirectionTo(f_Object )- l_turnedDirection ;
! //l_dashPwr=Math.max(0,l_dashPwr);
! l_dashPwr=Math.min(100,l_dashPwr);
! m_actionList.addLast(new Action(TURN, l_moment, 0));
! m_actionList.addLast(new Action(DASH, l_dashPwr,0));
! m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
!
! // logger.debug("Turn: " + l_moment + " DashPwr: " + l_dashPwr + " KickDir: " + l_kickDir );
! // logger.debug("distance: " + m_myWorld.getBall().getDistance()+ " dashpower: " + l_dashPwr);
! // logger.debug("speed: " + m_myWorld.getSenseBodyInfo().m_amountOfSpeed );
! break;
! default:
! logger.debug("Hier hat jemand den falschen Cycle errechnet");
! }
}
--- 203,207 ----
public void kickTo(double f_power, ObjectInfo f_Object, int f_cycle)
{
! kickTo(f_power,f_Object.getAbsPosition(),f_cycle);
}
***************
*** 304,309 ****
{
m_myCom.kick(( (Action) m_actionList.getFirst() ).getActionValue1(), ( (Action) m_actionList.getFirst() ).getActionValue2());
! // logger.warn(" --- KICK send to Server ---") ;
! //turn our head to where we kicked the ball
l_actionAngle=((Action)m_actionList.getFirst()).getActionValue2()/moment();
}
--- 223,227 ----
{
m_myCom.kick(( (Action) m_actionList.getFirst() ).getActionValue1(), ( (Action) m_actionList.getFirst() ).getActionValue2());
! //turn our head to where we kicked the ball to
l_actionAngle=((Action)m_actionList.getFirst()).getActionValue2()/moment();
}
***************
*** 313,317 ****
}
! m_myWorld.informKick(( (Action) m_actionList.getFirst() ).getActionValue1(), l_actionAngle );
break;
--- 231,235 ----
}
! // m_myWorld.informKick(( (Action) m_actionList.getFirst() ).getActionValue1(), l_actionAngle );
break;
***************
*** 321,330 ****
m_myCom.turn(((Action)m_actionList.getFirst()).getActionValue1());
l_actionAngle=(((Action)m_actionList.getFirst()).getActionValue1() / moment());
! /*
! if (m_actionList.size() < 3 && ((Action)m_actionList.getFirst()).getActionValue2() > -50) // correct view angle
! m_myCom.turnNeck(-((Action)m_actionList.getFirst()).getActionValue1());
! */
! // logger.warn(" --- TURN send to Server ---");
!
}
catch (xCommunication xCom)
--- 239,243 ----
m_myCom.turn(((Action)m_actionList.getFirst()).getActionValue1());
l_actionAngle=(((Action)m_actionList.getFirst()).getActionValue1() / moment());
! // nop();
}
catch (xCommunication xCom)
***************
*** 332,336 ****
logger.debug("Could not send turn action!"+xCom.getMessage());
}
! m_myWorld.informTurn(l_actionAngle );
break;
--- 245,249 ----
logger.debug("Could not send turn action!"+xCom.getMessage());
}
! // m_myWorld.informTurn(l_actionAngle );
break;
***************
*** 339,348 ****
{
m_myCom.dash(((Action)m_actionList.getFirst()).getActionValue1());
! if(!m_visualUpdateHappened)
{
! if (m_myWorld.getBall().isVisible())
! {
! /** @todo turn neck here, so we dont loose ball when dashing */
! }
}
}
--- 252,259 ----
{
m_myCom.dash(((Action)m_actionList.getFirst()).getActionValue1());
! // m_myWorld.informDash(((Action)m_actionList.getFirst()).getActionValue1());
! if (m_myWorld.getBall().isVisible())
{
! /** @todo turn neck here, so we dont loose ball when dashing */
}
}
***************
*** 351,355 ****
logger.debug("Could not send dash action!"+xCom.getMessage());
}
! m_myWorld.informDash(((Action)m_actionList.getFirst()).getActionValue1());
// logger.warn(" --- DASH send to Server ---") ;
break;
--- 262,266 ----
logger.debug("Could not send dash action!"+xCom.getMessage());
}
!
// logger.warn(" --- DASH send to Server ---") ;
break;
***************
*** 365,369 ****
}
! m_myWorld.informMove(((Action)m_actionList.getFirst()).getActionValue1(), ( (Action) m_actionList.getFirst() ).getActionValue2());
// logger.warn(" --- MOVE send to Server ---") ;
break;
--- 276,280 ----
}
! // m_myWorld.informMove(((Action)m_actionList.getFirst()).getActionValue1(), ( (Action) m_actionList.getFirst() ).getActionValue2());
// logger.warn(" --- MOVE send to Server ---") ;
break;
***************
*** 379,383 ****
}
! m_myWorld.informCatchBall(m_myWorld.getBodyDirectionTo(m_myWorld.getBall()));
break;
case SAY:
--- 290,294 ----
}
! // m_myWorld.informCatchBall(m_myWorld.getBodyDirectionTo(m_myWorld.getBall()));
break;
case SAY:
***************
*** 407,411 ****
double l_angleToBall=m_myWorld.getBall().getDirection();
m_myCom.turnNeck(l_angleToBall-l_actionAngle);
! m_myWorld.informTurnNeck(l_angleToBall-l_actionAngle);
m_visualUpdateHappened=false;
}
--- 318,322 ----
double l_angleToBall=m_myWorld.getBall().getDirection();
m_myCom.turnNeck(l_angleToBall-l_actionAngle);
! // m_myWorld.informTurnNeck(l_angleToBall-l_actionAngle);
m_visualUpdateHappened=false;
}
***************
*** 413,422 ****
{
m_myCom.turnNeck(l_actionAngle);
! m_myWorld.informTurnNeck(l_actionAngle);
}
else
{
m_myCom.turnNeck(-m_myWorld.getNeckDirection());
! m_myWorld.informTurnNeck(-m_myWorld.getNeckDirection());
}
}
--- 324,333 ----
{
m_myCom.turnNeck(l_actionAngle);
! // m_myWorld.informTurnNeck(l_actionAngle);
}
else
{
m_myCom.turnNeck(-m_myWorld.getNeckDirection());
! // m_myWorld.informTurnNeck(-m_myWorld.getNeckDirection());
}
}
***************
*** 426,430 ****
}
}
! m_actionList.removeFirst();
}
else //action list is empty
--- 337,341 ----
}
}
! m_actionList.remove(0);
}
else //action list is empty
***************
*** 441,445 ****
public void run(int f_power)
{
! m_actionList.addLast(new Action(DASH, f_power, 0));
// nop();
// nop();
--- 352,356 ----
public void run(int f_power)
{
! m_actionList.add(m_actionList.size(),new Action(DASH, f_power, 0));
// nop();
// nop();
***************
*** 453,461 ****
* @roseuid 3CE8EFE00170
*/
! public void runTo(double f_power,Coordinate f_position)
{
double l_power;
double l_deltaAngle=m_myWorld.getBodyDirectionTo(f_position);
double l_moment= l_deltaAngle * moment();
// Rückwarts rennen
// if (runAback(f_position)) {
--- 364,374 ----
* @roseuid 3CE8EFE00170
*/
! public void runTo(double f_power,Coordinate f_position, int f_cycles)
{
double l_power;
double l_deltaAngle=m_myWorld.getBodyDirectionTo(f_position);
double l_moment= l_deltaAngle * moment();
+ double l_percentageOfPower=f_power/100;
+ boolean l_turnHappened=false;
// Rückwarts rennen
// if (runAback(f_position)) {
***************
*** 468,502 ****
// }
-
// Muss ich mich zum Ball drehen?
// JA
! if (Math.abs(l_deltaAngle) > TOLERANCEANGLE){
! //Power auf zwei DASH aufteilen
! // Voller Power
! if (m_myWorld.getMyself().getDistanceTo(f_position) > getDistanceFromAccel2(pwr2edp(f_power )))
! l_power=f_power;
! // Power der Gesch. und Dist. anpassen
! else
! l_power=edp2pwr(getAccelFromDistance2(m_myWorld.getMyself().getDistanceTo(f_position)-MINDISTTOBALL));
!
! m_actionList.addLast(new Action(TURN, l_moment, 0));
! m_actionList.addLast(new Action(DASH, l_power, 0));
! m_actionList.addLast(new Action(DASH, l_power, 0));
! // logger.debug("-----Drehmoment: " + l_moment + " gewünschter Winkel: " + l_deltaAngle );
! // logger.debug("----- Power(Pos-Turn) : "+ l_Power + " D: " + m_myWorld.getMyself().getDistanceTo(f_position) );
}
! // NEIN
! else {
! //Power auf drei DASH aufteilen
! // Voller Power
! if (m_myWorld.getMyself().getDistanceTo(f_position) > getDistanceFromAccel3(pwr2edp( f_power )))
! l_power=f_power;
! // Power der Gesch. und Dist. anpassen
! else
! l_power=edp2pwr(getAccelFromDistance3(m_myWorld.getMyself().getDistanceTo(f_position)-MINDISTTOBALL));
! m_actionList.addLast(new Action(DASH, l_power, 0));
! m_actionList.addLast(new Action(DASH, l_power, 0));
! m_actionList.addLast(new Action(DASH, l_power, 0));
! // logger.debug("----- Power(Pos-No-Turn): "+ l_Power +" D: "+m_myWorld.getMyself().getDistanceTo(f_position) );
}
}
--- 381,426 ----
// }
// Muss ich mich zum Ball drehen?
// JA
! if(Math.abs(l_deltaAngle)>TOLERANCEANGLE)
! {
! m_actionList.add(new Action(TURN,l_moment,0));
! l_turnHappened=true;
}
! // logger.fatal("running to ball (turned)?" + l_turnHappened +" cycles "+ f_cycles +" moment "+ l_moment + " l_deltaAngle " +l_deltaAngle );
! // logger.fatal("absbodydirtoball"+m_myWorld.getBodyDirectionTo(m_myWorld.getBall()));
! switch(f_cycles)
! {
! case SenseBodyInfo.NARROW:
! if (!l_turnHappened)
! {
! l_power=edp2pwr((m_myWorld.getMyDistanceTo(f_position)-ServerConf.BALL_SIZE/2-ServerConf.PLAYER_SIZE/2-m_myWorld.getSenseBodyInfo().m_amountOfSpeed));
! m_actionList.add(new Action(DASH,Math.min(100,l_power),0));
! }
! break;
! case SenseBodyInfo.NORMAL:
! if(l_turnHappened)
! m_actionList.add(new Action(DASH,f_power,0));
! else
! {
! m_actionList.add(new Action(DASH,f_power,0));
! m_actionList.add(new Action(DASH,f_power,0));
! }
! break;
! case SenseBodyInfo.WIDE:
! if(!l_turnHappened)
! {
! m_actionList.add(new Action(DASH,f_power,0));
! m_actionList.add(new Action(DASH,f_power,0));
! m_actionList.add(new Action(DASH,f_power,0));
! }
! else
! {
! m_actionList.add(new Action(DASH,f_power,0));
! m_actionList.add(new Action(DASH,f_power,0));
! }
! break;
! default:
! return;
}
}
***************
*** 505,562 ****
/**
! * Run to an <code>ObjectInfo</code> with a given power
*
* @param f_power a <code>double</code> value
* @param f_Object an <code>ObjectInfo</code> value
*/
! public void runTo(double f_power,ObjectInfo f_Object)
{
! double l_power;
! double l_deltaAngle=m_myWorld.getBodyDirectionTo( f_Object );
! double l_moment=l_deltaAngle * moment();
!
!
!
! // if (runAback(f_Object.getAbsPosition())) {
! // f_power = -f_power;
! // l_correctedPower = -l_correctedPower;
! // if (l_deltaAngle > 0)
! // l_deltaAngle -= 180;
! // else
! // l_deltaAngle += 180;
! // }
!
! // Muss ich mich zum Ball drehen?
! // JA
! if (Math.abs(l_deltaAngle) > TOLERANCEANGLE){
! //Power auf zwei DASH aufteilen
! // Voller Power
! if ( m_myWorld.getMyDistanceTo(f_Object) > getDistanceFromAccel2(pwr2edp(f_power )))
! l_power=f_power;
! // Power der Gesch. und Dist. anpassen
! else
! l_power=edp2pwr(getAccelFromDistance2( m_myWorld.getMyDistanceTo(f_Object)-MINDISTTOBALL));
! m_actionList.addLast(new Action(TURN, l_moment, 0));
! m_actionList.addLast(new Action(DASH, l_power, 0));
! m_actionList.addLast(new Action(DASH, l_power, 0));
! // logger.debug("-----Drehmoment: " + l_moment + " gewünschter Winkel: " + l_deltaAngle );
!
! // logger.debug("----- Power(Obj-Turn): "+ l_Power+ " D: " + m_myWorld.getMyDistanceTo(f_Object) );
! }
! // NEIN
! else{
! //Power auf drei DASH aufteilen
! // Voller Power
! if ( m_myWorld.getMyDistanceTo(f_Object) > getDistanceFromAccel3(pwr2edp(f_power )))
! l_power=f_power;
! // Power der Gesch. und Dist. anpassen
! else
! l_power=edp2pwr(getAccelFromDistance3( m_myWorld.getMyDistanceTo(f_Object)-MINDISTTOBALL));
! m_actionList.addLast(new Action(DASH, l_power, 0));
! m_actionList.addLast(new Action(DASH, l_power, 0));
! m_actionList.addLast(new Action(DASH, l_power, 0));
!
! // logger.debug("----- Power(Obj-No-Turn): "+ l_Power + " D: " + m_myWorld.getMyDistanceTo(f_Object) );
! }
}
--- 429,440 ----
/**
! * Wrapper for runTo with an ObjectInfo
*
* @param f_power a <code>double</code> value
* @param f_Object an <code>ObjectInfo</code> value
*/
! public void runTo(double f_power,ObjectInfo f_Object, int f_cycles)
{
! runTo(f_power,f_Object.getAbsPosition(), f_cycles);
}
***************
*** 570,574 ****
public void turn(double f_angle)
{
! m_actionList.addLast(new Action(TURN, f_angle*moment(), -100));
// nop();
// nop();
--- 448,452 ----
public void turn(double f_angle)
{
! m_actionList.add(m_actionList.size(),new Action(TURN, f_angle*moment(), -100));
// nop();
// nop();
***************
*** 587,609 ****
case 0:
l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
! m_actionList.addLast(new Action(CATCHBALL, l_deltaAngle, 0));
// nop();
// nop();
break;
case 1:
! l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
nop();
! m_actionList.addLast(new Action(CATCHBALL, l_deltaAngle, 0));
// nop();
break;
case 2:
! l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
nop();
nop();
! m_actionList.addLast(new Action(CATCHBALL, l_deltaAngle, 0));
break;
}
-
- //m_myState.IncActionCounter();
}
--- 465,486 ----
case 0:
l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
! m_actionList.add(m_actionList.size(),new Action(CATCHBALL, l_deltaAngle, 0));
// nop();
// nop();
break;
case 1:
! l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall().getAbsPositionOfNextRound());
nop();
! m_actionList.add(m_actionList.size(),new Action(CATCHBALL, l_deltaAngle, 0));
// nop();
break;
case 2:
! Coordinate l_coord = m_myWorld.getBall().getAbsPositionOfNextRound().sub(m_myWorld.getBall().getAbsPosition());
! l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall().getAbsPositionOfNextRound().add(l_coord.scaleWith(ServerConf.BALL_DECAY)));
nop();
nop();
! m_actionList.add(m_actionList.size(),new Action(CATCHBALL, l_deltaAngle, 0));
break;
}
}
***************
*** 617,624 ****
public void moveTo(Coordinate f_coord)
{
! m_actionList.addLast(new Action(MOVE, f_coord.getX(), f_coord.getY()));
! // nop();
! // nop();
! //m_myState.IncActionCounter();
}
--- 494,498 ----
public void moveTo(Coordinate f_coord)
{
! m_actionList.add(m_actionList.size(),new Action(MOVE, f_coord.getX(), f_coord.getY()));
}
***************
*** 629,634 ****
public void nop()
{
! m_actionList.addLast(new Action(NOP, 0,0));
! //m_myState.IncActionCounter();
}
--- 503,507 ----
public void nop()
{
! m_actionList.add(m_actionList.size(),new Action(NOP, 0,0));
}
***************
*** 660,667 ****
public boolean listEmpty()
{
! boolean l_bool = false;
! if (m_actionList.isEmpty())
! l_bool = true;
! return l_bool;
}
--- 533,537 ----
public boolean listEmpty()
{
! return (m_actionList.isEmpty());
}
***************
*** 781,783 ****
--- 651,721 ----
}
}
+
+ public void run()
+ {
+ Thread l_thisThread = currentThread();
+ while(l_thisThread==m_performerThread)
+ {
+ try
+ {
+ sleep(80);
+ performAction();
+ // logger.fatal("action performed"+System.currentTimeMillis());
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ logger.fatal("running on....");
+ }
+ m_threadSuspended=true; //we want to suspend ourself after one run
+ try
+ {
+ synchronized(this)
+ {
+ while (m_threadSuspended && l_thisThread==m_performerThread) //check again if we should sleep,
+ {
+ //logger.info("\t" + getName() + ": Going to wait now for something new");
+ wait(); // this command lets our thread sleep until we wake him up
+ }
+ }
+ }
+ catch(java.lang.Exception ex)
+ {
+ //logger.info("\t" + getName() + ": ARGG! Got an exception while sleeping ... "+ ex.getMessage());
+ }
+ }//of while()
+ //logger.info("\t" + getName() + ": i've left my while-loop. run() will stop immediatly
+ }
+
+ /**
+ * With this method the KI is started at the beginning
+ *
+ */
+ public void startActionPerformer()
+ {
+ m_performerThread=this;
+ m_performerThread.start();
+ }
+
+
+ /**
+ * this method stops our Thread
+ */
+ public synchronized void stopActionPerformer()
+ {
+ m_performerThread = null; //get a clean outcome
+ notify();
+ }
+
+
+ /**
+ * this method says our thread that there's something to do
+ */
+ public synchronized void activatePerformCounter()
+ {
+ m_threadSuspended=false; // ok, he can run again if he wants to
+ notify();
+ }
+
+
}
|
|
From: <mae...@us...> - 2002-07-14 14:01:26
|
Update of /cvsroot/jais/jaisteam/src/jais/world
In directory usw-pr-cvs1:/tmp/cvs-serv4108/world
Modified Files:
WorldModel.java WorldDataAccessInterface.java
Log Message:
change viewModes not ready yet, but massively improved
added a new thread, an actionPerformer .... this is needed as
of timing issues
Index: WorldModel.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/world/WorldModel.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** WorldModel.java 13 Jul 2002 20:29:23 -0000 1.57
--- WorldModel.java 14 Jul 2002 14:01:23 -0000 1.58
***************
*** 83,86 ****
--- 83,87 ----
public double getBodyDirectionTo(ObjectInfo f_obj)
{
+ /*
if (this.sorry_whatTimeDoWeHave()-f_obj.getTime()==0)
{
***************
*** 91,126 ****
return getBodyDirectionTo(f_obj.getAbsPosition());
}
}
! public synchronized double getBodyDirectionTo(Coordinate f_coord)
{
double l_angle=0;
! l_angle=Math.atan((f_coord.getY()-m_myself.getAbsPosition().getY())/(f_coord.getX()-m_myself.getAbsPosition().getX()));
l_angle=(Math.toDegrees(l_angle)-getAbsBodyDir());
- if (f_coord.getY()<m_myself.getAbsPosition().getY())
- {
- if (f_coord.getX()>=m_myself.getAbsPosition().getX())
- {
- l_angle+=360;
- }
- else
- {
- l_angle-= -180;
- }
- }
- else
- {
- if (f_coord.getX()>=m_myself.getAbsPosition().getX())
- {
- }
- else
- {
- l_angle= l_angle+180;
- }
- }
return Angle.normalize(l_angle);
}
! public synchronized double getMyDistanceTo(Coordinate f_coord)
{
return (Math.sqrt((Math.pow(Math.abs(m_myself.getAbsPosition().getX() - f_coord.getX()), 2)) +
--- 92,108 ----
return getBodyDirectionTo(f_obj.getAbsPosition());
}
+ */
+ return getBodyDirectionTo(f_obj.getAbsPosition());
}
! public double getBodyDirectionTo(Coordinate f_coord)
{
double l_angle=0;
! l_angle=Math.atan2(f_coord.getY()-m_myself.getAbsPosition().getY(),(f_coord.getX()-m_myself.getAbsPosition().getX()));
l_angle=(Math.toDegrees(l_angle)-getAbsBodyDir());
return Angle.normalize(l_angle);
}
! public double getMyDistanceTo(Coordinate f_coord)
{
return (Math.sqrt((Math.pow(Math.abs(m_myself.getAbsPosition().getX() - f_coord.getX()), 2)) +
***************
*** 129,134 ****
}
! public synchronized double getMyDistanceTo(ObjectInfo f_object)
{
if(this.sorry_whatTimeDoWeHave()-f_object.getTime()==0) //we saw this guy this round
{
--- 111,118 ----
}
! public double getMyDistanceTo(ObjectInfo f_object)
{
+ return getMyDistanceTo(f_object.getAbsPosition());
+ /*
if(this.sorry_whatTimeDoWeHave()-f_object.getTime()==0) //we saw this guy this round
{
***************
*** 139,142 ****
--- 123,127 ----
return getMyDistanceTo(f_object.getAbsPosition());
}
+ */
}
***************
*** 153,162 ****
}
! public synchronized ArrayList getEnemyPlayers()
{
return m_enemyTeam;
}
! public synchronized ArrayList getFriendlyPlayers()
{
return m_ownTeam;
--- 138,147 ----
}
! public ArrayList getEnemyPlayers()
{
return m_enemyTeam;
}
! public ArrayList getFriendlyPlayers()
{
return m_ownTeam;
***************
*** 165,170 ****
public SenseBodyInfo getSenseBodyInfo()
{
- synchronized(m_senseBodyInfos)
- {
try
{
--- 150,153 ----
***************
*** 177,189 ****
return(SenseBodyInfo)m_senseBodyInfos.getLast();
}
- }
}
! public synchronized BallInfo getBall()
{
return m_ball;
}
! public synchronized PlayerInfo getMyself()
{
return m_myself;
--- 160,171 ----
return(SenseBodyInfo)m_senseBodyInfos.getLast();
}
}
! public BallInfo getBall()
{
return m_ball;
}
! public PlayerInfo getMyself()
{
return m_myself;
***************
*** 309,312 ****
--- 291,295 ----
{
m_ball=(BallInfo)l_objectInfo;
+ // logger.fatal("time:"+m_ball.getTime()+"direction "+ m_ball.getDirection() +" distance"+ m_ball.getDistance());
m_ball.setVisible(true);
}
***************
*** 333,346 ****
public void updateSenseBodyInfo(SenseBodyEvent f_senseBodyEvent)
{
! synchronized(m_senseBodyInfos)
{
! while(m_senseBodyInfos.size()>=STORAGE_COUNT_OF_INFOS)
! m_senseBodyInfos.removeFirst();
! if(!f_senseBodyEvent.getObjects().isEmpty())
! {
! m_senseBodyInfos.addLast(f_senseBodyEvent.getObjects().get(0));
! logger.info("added a SenseBodyInfo to my List");
! }
}
}
--- 316,328 ----
public void updateSenseBodyInfo(SenseBodyEvent f_senseBodyEvent)
{
! // logger.fatal("turn count "+((SenseBodyInfo)f_senseBodyEvent.getObjects().get(0)).m_turnCount);
! while(m_senseBodyInfos.size()>=STORAGE_COUNT_OF_INFOS)
! m_senseBodyInfos.removeFirst();
! if(!f_senseBodyEvent.getObjects().isEmpty())
{
! m_senseBodyInfos.addLast(f_senseBodyEvent.getObjects().get(0));
! logger.info("added a SenseBodyInfo to my List");
}
+
}
Index: WorldDataAccessInterface.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/world/WorldDataAccessInterface.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** WorldDataAccessInterface.java 13 Jul 2002 20:29:24 -0000 1.9
--- WorldDataAccessInterface.java 14 Jul 2002 14:01:23 -0000 1.10
***************
*** 1,7 ****
package jais.world;
import jais.objects.*;
- import java.util.ArrayList;
- import java.util.LinkedList;
/**
--- 1,6 ----
package jais.world;
+ import java.util.*;
import jais.objects.*;
/**
|
|
From: <mae...@us...> - 2002-07-14 14:01:26
|
Update of /cvsroot/jais/jaisteam/src/jais/communication
In directory usw-pr-cvs1:/tmp/cvs-serv4108/communication
Modified Files:
Communication.java
Log Message:
change viewModes not ready yet, but massively improved
added a new thread, an actionPerformer .... this is needed as
of timing issues
Index: Communication.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/Communication.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** Communication.java 13 Jul 2002 16:21:51 -0000 1.30
--- Communication.java 14 Jul 2002 14:01:23 -0000 1.31
***************
*** 208,212 ****
try
{
! logger.info("Server Message is: "+m_stuffToSendToServer);
// init buffer
byte[] l_buffer = new byte[1024];
--- 208,212 ----
try
{
! //logger.fatal("Server Message is: "+m_stuffToSendToServer + " time:" +System.currentTimeMillis() );
// init buffer
byte[] l_buffer = new byte[1024];
***************
*** 303,306 ****
--- 303,307 ----
try
{
+ // logger.fatal("Dash sent with power :" + f_dashPower);
sendMessageToServer("(dash "+f_dashPower+")");
}
***************
*** 546,550 ****
if (m_receivedMessageFromServer.startsWith("(sense"))
{
! logger.info("Sense_Body event detected...");
SenseBodyEvent newSenseBodyEvent = new SenseBodyEvent(m_receivedMessageFromServer);
m_jais.onSenseBody(newSenseBodyEvent);
--- 547,551 ----
if (m_receivedMessageFromServer.startsWith("(sense"))
{
! // logger.fatal("Sense_Body event detected..." + System.currentTimeMillis()+"*******************");
SenseBodyEvent newSenseBodyEvent = new SenseBodyEvent(m_receivedMessageFromServer);
m_jais.onSenseBody(newSenseBodyEvent);
***************
*** 553,557 ****
else if (m_receivedMessageFromServer.startsWith("(see"))
{
! logger.info("Visual event detected...");
VisualEvent newVisualEvent = new VisualEvent(m_receivedMessageFromServer);
m_jais.onSee(newVisualEvent);
--- 554,558 ----
else if (m_receivedMessageFromServer.startsWith("(see"))
{
! // logger.fatal("Visual event detected..."+System.currentTimeMillis()+"*******************");
VisualEvent newVisualEvent = new VisualEvent(m_receivedMessageFromServer);
m_jais.onSee(newVisualEvent);
|
|
From: <pr...@us...> - 2002-07-13 23:45:14
|
Update of /cvsroot/jais/jaisteam/src/jais/visualization
In directory usw-pr-cvs1:/tmp/cvs-serv19700/jais/visualization
Modified Files:
PlayFieldPanel.java
Log Message:
corrected the displaying of the objects on playfield:
set to int cast on correct pos. and subtr. the objects radius
Index: PlayFieldPanel.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/visualization/PlayFieldPanel.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** PlayFieldPanel.java 13 Jul 2002 16:21:51 -0000 1.18
--- PlayFieldPanel.java 13 Jul 2002 23:45:11 -0000 1.19
***************
*** 235,240 ****
l_flagInfo = (FlagInfo) it.next();
Coordinate l_coord=m_myWorld.getMyself().getAbsPosition();
! drawFlag(determNewXPosition((int)l_flagInfo.calculateAbsPosition(l_coord,m_myWorld.getAbsViewAngle()).getX()),
! determNewYPosition((int)l_flagInfo.calculateAbsPosition(l_coord,m_myWorld.getAbsViewAngle()).getY()),
l_isSeenFlag
);
--- 235,240 ----
l_flagInfo = (FlagInfo) it.next();
Coordinate l_coord=m_myWorld.getMyself().getAbsPosition();
! drawFlag((int)determNewXPosition(l_flagInfo.calculateAbsPosition(l_coord,m_myWorld.getAbsViewAngle()).getX()),
! (int)determNewYPosition(l_flagInfo.calculateAbsPosition(l_coord,m_myWorld.getAbsViewAngle()).getY()),
l_isSeenFlag
);
***************
*** 257,262 ****
l_flagInfo = (FlagInfo) it.next();
Coordinate l_coord=m_myWorld.getMyself().getAbsPosition();
! drawFlag(determNewXPosition((int)l_flagInfo.calculateAbsPosition(l_coord,m_myWorld.getAbsViewAngle()).getX()),
! determNewYPosition((int)l_flagInfo.calculateAbsPosition(l_coord,m_myWorld.getAbsViewAngle()).getY()),
l_isSeenFlag
);
--- 257,262 ----
l_flagInfo = (FlagInfo) it.next();
Coordinate l_coord=m_myWorld.getMyself().getAbsPosition();
! drawFlag((int)determNewXPosition(l_flagInfo.calculateAbsPosition(l_coord,m_myWorld.getAbsViewAngle()).getX()),
! (int)determNewYPosition(l_flagInfo.calculateAbsPosition(l_coord,m_myWorld.getAbsViewAngle()).getY()),
l_isSeenFlag
);
***************
*** 329,341 ****
//determ first the x and y pos. of the second point of
//body direction line
! drawMyselfBodyDirection(determNewXPosition(
! determSecondLinePointOfMyselfBodyDirectionX(
! m_myWorld.getAbsBodyDir())
! ),
! determNewYPosition(
! determSecondLinePointOfMyselfBodyDirectionY(
! m_myWorld.getAbsBodyDir())
! )
! );
logger.info("Read/Drew body direction info!");
--- 329,335 ----
//determ first the x and y pos. of the second point of
//body direction line
! drawMyselfBodyDirection(determNewXPosition(determSecondLinePointOfMyselfBodyDirectionX(m_myWorld.getAbsBodyDir()))
! ,determNewYPosition(determSecondLinePointOfMyselfBodyDirectionY(m_myWorld.getAbsBodyDir()))
! );
logger.info("Read/Drew body direction info!");
***************
*** 345,351 ****
//body direction line
m_myselfBodyAngle = m_myWorld.getAbsBodyDir();
! int myselfBodyDirX=determNewXPosition(determSecondLinePointOfMyselfBodyDirectionX(m_myselfBodyAngle));
! int myselfBodyDirY=determNewYPosition(determSecondLinePointOfMyselfBodyDirectionY(m_myselfBodyAngle));
! drawMyselfBodyDirection(myselfBodyDirX,myselfBodyDirY);
logger.info("Read/Drew body direction info!");
--- 339,345 ----
//body direction line
m_myselfBodyAngle = m_myWorld.getAbsBodyDir();
! int l_myselfBodyDirX=determNewXPosition(determSecondLinePointOfMyselfBodyDirectionX(m_myselfBodyAngle));
! int l_myselfBodyDirY=determNewYPosition(determSecondLinePointOfMyselfBodyDirectionY(m_myselfBodyAngle));
! drawMyselfBodyDirection(l_myselfBodyDirX,l_myselfBodyDirY);
logger.info("Read/Drew body direction info!");
***************
*** 360,365 ****
if(m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
{
! drawnBallPosInNextRound(determNewXPosition((int)(Math.round(m_myWorld.getBall().getAbsPositionOfNextRound().getX()))),
! determNewYPosition((int)(Math.round(m_myWorld.getBall().getAbsPositionOfNextRound().getY())))
);
}
--- 354,359 ----
if(m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
{
! drawnBallPosInNextRound((int)determNewXPosition((Math.round(m_myWorld.getBall().getAbsPositionOfNextRound().getX()))),
! (int)determNewYPosition((Math.round(m_myWorld.getBall().getAbsPositionOfNextRound().getY())))
);
}
***************
*** 382,393 ****
* @param f_nextPosY s
*/
! private void drawnBallPosInNextRound(int f_nextPosX,int f_nextPosY)
{
! int l_ballDiameterInNextRound = 7;
//set color of ball in next round
! m_graphics.setColor(Color.darkGray);
//draw ball in next round
! m_graphics.fillOval(f_nextPosX,f_nextPosY,l_ballDiameterInNextRound,l_ballDiameterInNextRound);
}
--- 376,387 ----
* @param f_nextPosY s
*/
! private void drawnBallPosInNextRound(int f_nextPosX, int f_nextPosY)
{
! int l_ballDiameterInNextRound = 8;
//set color of ball in next round
! m_graphics.setColor(Color.gray);
//draw ball in next round
! m_graphics.fillOval(f_nextPosX-4,f_nextPosY,l_ballDiameterInNextRound-4,l_ballDiameterInNextRound);
}
***************
*** 583,586 ****
--- 577,581 ----
private void drawSeenBall(int f_ballXPos,int f_ballYPos,boolean f_visible)
{
+ int l_ballDiameter=8;
logger.debug("Drawing seen ball!");
if(f_visible)
***************
*** 588,592 ****
else
m_graphics.setColor(COLOR_BALL_INVISIBLE);
! m_graphics.fillOval(f_ballXPos,f_ballYPos,7,7);
logger.debug("Drew seen seen ball!");
}
--- 583,587 ----
else
m_graphics.setColor(COLOR_BALL_INVISIBLE);
! m_graphics.fillOval(f_ballXPos-4,f_ballYPos-4,l_ballDiameter,l_ballDiameter);
logger.debug("Drew seen seen ball!");
}
|
|
From: <mae...@us...> - 2002-07-13 20:29:27
|
Update of /cvsroot/jais/jaisteam/src/jais/communication
In directory usw-pr-cvs1:/tmp/cvs-serv2840/communication
Modified Files:
SenseBodyEvent.java
Log Message:
set storage time to 2 seconds
changeViewModes implemented (all modes supported now)
Index: SenseBodyEvent.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/SenseBodyEvent.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** SenseBodyEvent.java 13 Jul 2002 16:21:51 -0000 1.9
--- SenseBodyEvent.java 13 Jul 2002 20:29:24 -0000 1.10
***************
*** 1,8 ****
package jais.communication;
! import java.util.ArrayList;
! import org.apache.log4j.Logger;
import jais.objects.*;
! import java.util.StringTokenizer;
/**
--- 1,9 ----
package jais.communication;
! import java.util.*;
!
!
import jais.objects.*;
! import org.apache.log4j.*;
/**
***************
*** 49,54 ****
l_tokenizer.nextToken(); // token 'view_mode'
! l_sense_body_info.m_viewQuality = l_tokenizer.nextToken(); // element view quality
! l_sense_body_info.m_viewMode = l_tokenizer.nextToken(); // element view mode
l_tokenizer.nextToken(); // token 'stamina'
--- 50,55 ----
l_tokenizer.nextToken(); // token 'view_mode'
! l_sense_body_info.m_ViewQuality=l_tokenizer.nextToken(); // element view quality
! l_sense_body_info.m_viewMode=l_tokenizer.nextToken(); // element view mode
l_tokenizer.nextToken(); // token 'stamina'
|
|
From: <mae...@us...> - 2002-07-13 20:29:27
|
Update of /cvsroot/jais/jaisteam/src/jais/player
In directory usw-pr-cvs1:/tmp/cvs-serv2840/player
Modified Files:
StateManager.java KI.java ActionManager.java
Log Message:
set storage time to 2 seconds
changeViewModes implemented (all modes supported now)
Index: StateManager.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/StateManager.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** StateManager.java 13 Jul 2002 16:21:51 -0000 1.12
--- StateManager.java 13 Jul 2002 20:29:24 -0000 1.13
***************
*** 19,22 ****
--- 19,24 ----
boolean m_athome=false;
int m_state= 1;
+ public static final int[] VIEW_ANGLES={45,90,180};
+ public int m_currentViewMode=1;
int m_actionCounter = 0;
***************
*** 66,71 ****
return m_athome;
}
-
-
-
}
--- 68,70 ----
Index: KI.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/KI.java,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -d -r1.76 -r1.77
*** KI.java 13 Jul 2002 16:21:51 -0000 1.76
--- KI.java 13 Jul 2002 20:29:24 -0000 1.77
***************
*** 41,47 ****
private final Coordinate GOALIE_HOME_POS = new Coordinate(-50, 0);
- private final double GOALIE_RANGE = 3;
- private final double MYMAXSPEED = 0.8;
private final double NORMPOWER = 50; //(ServerConf.MAXPOWER / 2);
private final double MINPOWER = 25; //(ServerConf.MAXPOWER / 4);
--- 41,45 ----
***************
*** 49,63 ****
private final int HOMERANGE_R = 5;
- private final int MAXRANGE_R = 25;
private final Coordinate MY_GOAL_POS = new Coordinate(-52.5, 0);
private final Coordinate ENEMY_GOAL_POS = new Coordinate(52.5, 0);
private final int MAX_GOAL_KICK_DISTANCE = 25;
! private final int MIN_DISTANCE_FOR_DRIBBEL = 3;
private final int MAX_PASS_DISTANCE =30;
private final int MAX_LOOKING_FORWARD_TIME = 20;
! private final int FREE_ANGLE = 18;
! private final double MIN_SPACE_IN_GOAL = 3.0;
! private final double DISTANCE_TO_BALL = 0.5;
ArrayList m_enemyTeam;
ArrayList m_ownTeam;
--- 47,61 ----
private final int HOMERANGE_R = 5;
private final Coordinate MY_GOAL_POS = new Coordinate(-52.5, 0);
private final Coordinate ENEMY_GOAL_POS = new Coordinate(52.5, 0);
private final int MAX_GOAL_KICK_DISTANCE = 25;
! private final int MIN_DISTANCE_FOR_DRIBBEL = 5;
private final int MAX_PASS_DISTANCE =30;
private final int MAX_LOOKING_FORWARD_TIME = 20;
! private final int FREE_ANGLE = 15;
!
! private int m_searchAngle;
!
ArrayList m_enemyTeam;
ArrayList m_ownTeam;
***************
*** 66,70 ****
StateManager m_myState;
-
/**
* Creates a new <code>KI</code> instance.
--- 64,67 ----
***************
*** 106,111 ****
{
logger.debug("Caught Execption from root in KI"+ex.getMessage());
! if(logger.getLevel().isGreaterOrEqual(Level.toPriority(Level.WARN_INT)))
! ex.printStackTrace();
logger.debug("Report this to jai...@li.... KI is still Working!");
}
--- 103,107 ----
{
logger.debug("Caught Execption from root in KI"+ex.getMessage());
! ex.printStackTrace();
logger.debug("Report this to jai...@li.... KI is still Working!");
}
***************
*** 146,149 ****
--- 142,146 ----
private void root()
{
+ manageViewMode();
switch(m_myWorld.getPlaymode())
{
***************
*** 293,297 ****
if(m_myWorld.getBall().getDistance() < ServerConf.KICKABLE_MARGIN )
{
! if(m_myWorld.getMyself().getAbsPosition().getX()<20)
l_tempPlayer =checkForPassPartner(20);
else if(m_myWorld.getMyself().getAbsPosition().getX()>40)
--- 290,294 ----
if(m_myWorld.getBall().getDistance() < ServerConf.KICKABLE_MARGIN )
{
! if(m_myWorld.getMyself().getAbsPosition().getX()<-30)
l_tempPlayer =checkForPassPartner(20);
else if(m_myWorld.getMyself().getAbsPosition().getX()>40)
***************
*** 470,476 ****
//check where the ball was the last time we saw it and turn to that direction
if (m_myWorld.getBall().getDirection() > 0)
! m_actions.turn(SenseBodyInfo.getAngleFromViewMode(m_myWorld.getViewMode())-10);
else
! m_actions.turn(-SenseBodyInfo.getAngleFromViewMode(m_myWorld.getViewMode())+10);
}
--- 467,473 ----
//check where the ball was the last time we saw it and turn to that direction
if (m_myWorld.getBall().getDirection() > 0)
! m_actions.turn(m_myState.VIEW_ANGLES[m_myState.m_currentViewMode]-15);
else
! m_actions.turn(-m_myState.VIEW_ANGLES[m_myState.m_currentViewMode]+15);
}
***************
*** 574,580 ****
private void gotoHomePosition()
{
! ArrayList l_enemyTeam=(ArrayList)m_myWorld.getEnemyPlayers().clone();
! ArrayList l_ownTeam=(ArrayList)m_myWorld.getFriendlyPlayers().clone();
! double l_offsideBarrier=getOffsideBarrier(l_enemyTeam,l_ownTeam); //seems there are
if(m_myWorld.getMyself().getAbsPosition().getX()>l_offsideBarrier-3)
{
--- 571,575 ----
private void gotoHomePosition()
{
! double l_offsideBarrier=getOffsideBarrier(m_enemyTeam,m_ownTeam); //seems there are
if(m_myWorld.getMyself().getAbsPosition().getX()>l_offsideBarrier-3)
{
***************
*** 796,810 ****
{
//get a cleosan copy of our ownTeam
- ArrayList l_ownTeam=(ArrayList)m_myWorld.getFriendlyPlayers().clone();
- ArrayList l_enemyTeam=(ArrayList)(m_myWorld.getEnemyPlayers().clone());
//Search pass partners
! if (!l_ownTeam.isEmpty())
{
PlayerInfo l_passPartner=null; // the one we pass to
PlayerInfo l_possiblePassPartner; //this would be a possibility
PlayerInfo l_enemyPlayer; //used later
! double l_offsideBarrier=this.getOffsideBarrier(l_enemyTeam,l_ownTeam); //get the Offside Barrier
! for (ListIterator it = l_ownTeam.listIterator(); it.hasNext();)
{
l_possiblePassPartner = (PlayerInfo) it.next();
--- 791,803 ----
{
//get a cleosan copy of our ownTeam
//Search pass partners
! if (!m_ownTeam.isEmpty())
{
PlayerInfo l_passPartner=null; // the one we pass to
PlayerInfo l_possiblePassPartner; //this would be a possibility
PlayerInfo l_enemyPlayer; //used later
! double l_offsideBarrier=this.getOffsideBarrier(m_enemyTeam,m_ownTeam); //get the Offside Barrier
! for (ListIterator it = m_ownTeam.listIterator(); it.hasNext();)
{
l_possiblePassPartner = (PlayerInfo) it.next();
***************
*** 817,823 ****
)
{
! if (!l_enemyTeam.isEmpty())
{
! for(ListIterator enemyIterator = l_enemyTeam.listIterator();it.hasNext();)
{
l_enemyPlayer=(PlayerInfo)it.next();
--- 810,816 ----
)
{
! if (!m_enemyTeam.isEmpty())
{
! for(ListIterator enemyIterator = m_enemyTeam.listIterator();it.hasNext();)
{
l_enemyPlayer=(PlayerInfo)it.next();
***************
*** 976,980 ****
}
-
/**
* Kick to a given Coordinate in a given cycle
--- 969,972 ----
***************
*** 985,993 ****
{
Coordinate l_kickVector= f_coord.sub(m_myWorld.getMyself().getAbsPosition());
! int l_kickpower = Math.min(100, 7*(int)Math.sqrt( l_kickVector.getX() *l_kickVector.getX() +l_kickVector.getY()*l_kickVector.getY()));
m_actions.kickTo(l_kickpower, f_coord, f_cycle);
}
-
/**
* Passto to a given player in a given cycle
--- 977,985 ----
{
Coordinate l_kickVector= f_coord.sub(m_myWorld.getMyself().getAbsPosition());
! //int l_kickpower = Math.min(100, 7*(int)Math.sqrt( l_kickVector.getX() *l_kickVector.getX() +l_kickVector.getY()*l_kickVector.getY()));
! double l_kickpower=MAXPOWER;
m_actions.kickTo(l_kickpower, f_coord, f_cycle);
}
/**
* Passto to a given player in a given cycle
***************
*** 1022,1026 ****
* @return int
*/
! private int ballAvailibleInNextRounds()
{
if (m_myWorld.getBall().isBallKickableBy(m_myWorld.getMyself()))
--- 1014,1018 ----
* @return int
*/
! private int ballAvailableInNextRounds()
{
if (m_myWorld.getBall().isBallKickableBy(m_myWorld.getMyself()))
***************
*** 1092,1097 ****
{
m_threadSuspended=false; // ok, he can run again if he wants to
! if (!m_threadSuspended) //check if we are suspended
! notify();
}
--- 1084,1088 ----
{
m_threadSuspended=false; // ok, he can run again if he wants to
! notify();
}
***************
*** 1128,1132 ****
return -1;
}
- }
--- 1119,1146 ----
return -1;
}
+ private void manageViewMode()
+ {
+ if(!m_myWorld.getBall().isVisible())
+ {
+ m_actions.changeView(SenseBodyInfo.WIDE,true);
+ m_myState.m_currentViewMode=SenseBodyInfo.WIDE;
+ }
+ else if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 5)
+ {
+ m_actions.changeView(SenseBodyInfo.NARROW,true);
+ m_myState.m_currentViewMode=SenseBodyInfo.NARROW;
+ }
+ else if (m_myWorld.getMyDistanceTo(m_myWorld.getBall())< 20)
+ {
+ m_actions.changeView(SenseBodyInfo.NORMAL,true);
+ m_myState.m_currentViewMode=SenseBodyInfo.NORMAL;
+ }
+ else
+ {
+ m_actions.changeView(SenseBodyInfo.WIDE,true);
+ m_myState.m_currentViewMode=SenseBodyInfo.WIDE;
+ }
+ }
+ }
Index: ActionManager.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/player/ActionManager.java,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -d -r1.58 -r1.59
*** ActionManager.java 13 Jul 2002 16:21:51 -0000 1.58
--- ActionManager.java 13 Jul 2002 20:29:24 -0000 1.59
***************
*** 47,52 ****
private int m_neckTurnDirection=1;
private boolean m_visualUpdateHappened=false;
- private boolean m_changeViewSend=false;
-
private static Logger logger=Logger.getLogger("jais.player");
--- 47,50 ----
***************
*** 127,135 ****
l_kickDir=m_myWorld.getBodyDirectionTo(f_position);
m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
! nop();
! nop();
break;
case 1:
// Is Ball moving?
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
{
--- 125,134 ----
l_kickDir=m_myWorld.getBodyDirectionTo(f_position);
m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
! // nop();
! // nop();
break;
case 1:
// Is Ball moving?
+ System.out.println("wanted to kick in 1 cycle");
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
{
***************
*** 152,158 ****
m_actionList.addLast(new Action(DASH,l_dashPwr , 0));
m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
! nop();
break;
case 2:
// Is Ball moving?
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null) {
--- 151,158 ----
m_actionList.addLast(new Action(DASH,l_dashPwr , 0));
m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
! // nop();
break;
case 2:
+ System.out.println("wanted to kick in 2 cycle");
// Is Ball moving?
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null) {
***************
*** 218,226 ****
l_kickDir=m_myWorld.getBodyDirectionTo(f_Object );
m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
! nop();
! nop();
break;
case 1:
// Is Ball moving?
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
{
--- 218,227 ----
l_kickDir=m_myWorld.getBodyDirectionTo(f_Object );
m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
! // nop();
! // nop();
break;
case 1:
// Is Ball moving?
+ System.out.println("wanted to kick in 1 cycle");
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null)
{
***************
*** 242,249 ****
m_actionList.addLast(new Action(DASH,l_dashPwr , 0));
m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
! nop();
break;
case 2:
// Is Ball moving?
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null) {
// Position of the ball when finally kicking
--- 243,251 ----
m_actionList.addLast(new Action(DASH,l_dashPwr , 0));
m_actionList.addLast(new Action(KICK, f_power, l_kickDir ));
! // nop();
break;
case 2:
// Is Ball moving?
+ System.out.println("wanted to kick in 2 cycle");
if (m_myWorld.getBall().getAbsPositionOfNextRound()!=null) {
// Position of the ball when finally kicking
***************
*** 293,307 ****
public void performAction()
{
- if(!m_changeViewSend)
- {
- try
- {
- m_myCom.changeView("wide",true);
- }
- catch (xCommunication xCom)
- {
- logger.debug("caught exception from commu while sending changeView"+xCom.getMessage());
- }
- }
if (!m_actionList.isEmpty())
{
--- 295,298 ----
***************
*** 451,456 ****
{
m_actionList.addLast(new Action(DASH, f_power, 0));
! nop();
! nop();
}
--- 442,447 ----
{
m_actionList.addLast(new Action(DASH, f_power, 0));
! // nop();
! // nop();
}
***************
*** 579,585 ****
public void turn(double f_angle)
{
! m_actionList.addLast(new Action(TURN, f_angle, -100));
! nop();
! nop();
//m_myState.IncActionCounter();
}
--- 570,576 ----
public void turn(double f_angle)
{
! m_actionList.addLast(new Action(TURN, f_angle*moment(), -100));
! // nop();
! // nop();
//m_myState.IncActionCounter();
}
***************
*** 597,602 ****
l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
m_actionList.addLast(new Action(CATCHBALL, l_deltaAngle, 0));
! nop();
! nop();
break;
case 1:
--- 588,593 ----
l_deltaAngle= m_myWorld.getBodyDirectionTo(m_myWorld.getBall());
m_actionList.addLast(new Action(CATCHBALL, l_deltaAngle, 0));
! // nop();
! // nop();
break;
case 1:
***************
*** 604,608 ****
nop();
m_actionList.addLast(new Action(CATCHBALL, l_deltaAngle, 0));
! nop();
break;
case 2:
--- 595,599 ----
nop();
m_actionList.addLast(new Action(CATCHBALL, l_deltaAngle, 0));
! // nop();
break;
case 2:
***************
*** 627,632 ****
{
m_actionList.addLast(new Action(MOVE, f_coord.getX(), f_coord.getY()));
! nop();
! nop();
//m_myState.IncActionCounter();
}
--- 618,623 ----
{
m_actionList.addLast(new Action(MOVE, f_coord.getX(), f_coord.getY()));
! // nop();
! // nop();
//m_myState.IncActionCounter();
}
***************
*** 772,775 ****
{m_visualUpdateHappened=true;}
!
}
--- 763,783 ----
{m_visualUpdateHappened=true;}
! public void changeView(int f_viewMode,boolean f_highViewQuality)
! {
! String l_viewModeString;
! if (f_viewMode==SenseBodyInfo.NARROW)
! l_viewModeString="narrow";
! else if(f_viewMode==SenseBodyInfo.WIDE)
! l_viewModeString="wide";
! else
! l_viewModeString="normal";
! try
! {
! m_myCom.changeView(l_viewModeString,f_highViewQuality);
! }
! catch (xCommunication ex)
! {
! logger.warn("changeViewQuality could not be send to server");
! }
! }
}
|
|
From: <mae...@us...> - 2002-07-13 20:29:27
|
Update of /cvsroot/jais/jaisteam/src/jais/objects
In directory usw-pr-cvs1:/tmp/cvs-serv2840/objects
Modified Files:
SenseBodyInfo.java
Log Message:
set storage time to 2 seconds
changeViewModes implemented (all modes supported now)
Index: SenseBodyInfo.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/objects/SenseBodyInfo.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** SenseBodyInfo.java 8 Jul 2002 02:27:15 -0000 1.10
--- SenseBodyInfo.java 13 Jul 2002 20:29:24 -0000 1.11
***************
*** 10,65 ****
public class SenseBodyInfo
{
! // These are the variables set by Parser. They are directly given from the server
! public double m_neckDirection;
! public int m_time;
! public String m_viewQuality;
! public String m_viewMode;
! public double m_stamina;
! public double m_effort;
! public double m_amountOfSpeed;
! public int m_directionOfSpeed;
! public int m_kickCount;
! public int m_dashCount;
! public int m_turnCount;
! public int m_sayCount;
! public int m_turnNeckCount;
! public int m_catchCount;
! public int m_moveCount;
! public int m_changeViewCount;
! /**
! * This method returns the corresponding angle to the given viewmode
! * @param f_viewmode the viewmode we want the angle of
! * @return Angle of f_viewmode
! */
! public static int getAngleFromViewMode(String f_viewmode)
! {
if(f_viewmode.equalsIgnoreCase("wide"))
! return 180;
else if(f_viewmode.equalsIgnoreCase("normal"))
! return 90;
else if(f_viewmode.equalsIgnoreCase("narrow"))
! return 45;
return -1;
! }
!
- /**
- * This method sets the neck direction
- * @param f_neckDirection contains the value which is setted
- */
- public void setNeckDirection(double f_neckDirection) { m_neckDirection=f_neckDirection;}
! /**
! * This method sets the view mode: {high|low} {narrow|normal|wide}
! * @param f_viewMode contains value which is setted: {high|low} {narrow|normal|wide}
! */
! public void setViewMode(String f_viewMode) { m_viewMode=f_viewMode; }
! /**
! * Access method for time
! * @return the time
! */
! public int getTime() {return m_time;}
! }
--- 10,65 ----
public class SenseBodyInfo
{
! //different view modes
! public static final int NARROW = 0;
! public static final int NORMAL = 1;
! public static final int WIDE = 2;
! // These are the variables set by Parser. They are directly given from the server
! public double m_neckDirection;
! public int m_time;
! public String m_ViewQuality;
! public String m_viewMode;
! public double m_stamina;
! public double m_effort;
! public double m_amountOfSpeed;
! public int m_directionOfSpeed;
! public int m_kickCount;
! public int m_dashCount;
! public int m_turnCount;
! public int m_sayCount;
! public int m_turnNeckCount;
! public int m_catchCount;
! public int m_moveCount;
! public int m_changeViewCount;
!
!
! /**
! * This method returns the corresponding angle to the given viewmode
! * @param f_viewmode the viewmode we want the angle of
! * @return Angle of f_viewmode
! */
! public static int getAngleFromViewMode(String f_viewmode)
! {
if(f_viewmode.equalsIgnoreCase("wide"))
! return 180;
else if(f_viewmode.equalsIgnoreCase("normal"))
! return 90;
else if(f_viewmode.equalsIgnoreCase("narrow"))
! return 45;
return -1;
! }
! /**
! * This method sets the neck direction
! * @param f_neckDirection contains the value which is setted
! */
! public void setNeckDirection(double f_neckDirection) { m_neckDirection=f_neckDirection;}
! /**
! * Access method for time
! * @return the time
! */
! public int getTime() {return m_time;}
! }
\ No newline at end of file
|
|
From: <mae...@us...> - 2002-07-13 20:29:27
|
Update of /cvsroot/jais/jaisteam/src/jais/world
In directory usw-pr-cvs1:/tmp/cvs-serv2840/world
Modified Files:
WorldModel.java WorldDataAccessInterface.java
Log Message:
set storage time to 2 seconds
changeViewModes implemented (all modes supported now)
Index: WorldModel.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/world/WorldModel.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** WorldModel.java 13 Jul 2002 16:21:52 -0000 1.56
--- WorldModel.java 13 Jul 2002 20:29:23 -0000 1.57
***************
*** 22,26 ****
private int m_playerNumber; // where the playerNumber is stored
! private final int FORGET_TIME= 1*10; // x-seconds
private final double NOT_MOVING=0.01; // if deltaVector is smaller than we say Object did not move
--- 22,26 ----
private int m_playerNumber; // where the playerNumber is stored
! private final int FORGET_TIME= 3*10; // x-seconds
private final double NOT_MOVING=0.01; // if deltaVector is smaller than we say Object did not move
***************
*** 242,245 ****
--- 242,251 ----
return getSenseBodyInfo().m_viewMode;
}
+
+ public String getViewQuality()
+ {
+ return getSenseBodyInfo().m_ViewQuality;
+ }
+
Index: WorldDataAccessInterface.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/world/WorldDataAccessInterface.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** WorldDataAccessInterface.java 13 Jul 2002 16:21:52 -0000 1.8
--- WorldDataAccessInterface.java 13 Jul 2002 20:29:24 -0000 1.9
***************
*** 137,140 ****
--- 137,146 ----
public String getViewMode();
+ /**
+ *
+ * @return boolean, true if HighQuality, false if low
+ */
+ public String getViewQuality();
+
/**************************************************************************************************/
/* Here follow methods provided for the visualization of our WorldModel
|
|
From: <mae...@us...> - 2002-07-13 16:21:54
|
Update of /cvsroot/jais/jaisteam/src/jais/visualization
In directory usw-pr-cvs1:/tmp/cvs-serv32242/visualization
Modified Files:
PlayFieldPanel.java Visualization.java
Log Message:
added muchos vielos tabulatoros... jb 7.0 is really fine ;)
changed the handling of the enemy and own team lists:
the list is fetched at the beginning of the KI cycle and stored in an
internal reference (m_enemyTeam m_ownTeam).
Index: PlayFieldPanel.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/visualization/PlayFieldPanel.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** PlayFieldPanel.java 9 Jul 2002 07:53:39 -0000 1.17
--- PlayFieldPanel.java 13 Jul 2002 16:21:51 -0000 1.18
***************
*** 69,73 ****
* accepts model from view
*
! * @param f_world
*/
public PlayFieldPanel(WorldModel f_world)
--- 69,73 ----
* accepts model from view
*
! * @param f_world s
*/
public PlayFieldPanel(WorldModel f_world)
***************
*** 96,100 ****
* redrawn (e.g. on repaint by OS or Jais)
*
! * @param f_g
*/
public void paintComponent(Graphics f_g)
--- 96,100 ----
* redrawn (e.g. on repaint by OS or Jais)
*
! * @param f_g s
*/
public void paintComponent(Graphics f_g)
***************
*** 379,384 ****
* This method draws the pos. of the ball in next round
*
! * @param f_nextPosX
! * @param f_nextPosY
*/
private void drawnBallPosInNextRound(int f_nextPosX,int f_nextPosY)
--- 379,384 ----
* This method draws the pos. of the ball in next round
*
! * @param f_nextPosX s
! * @param f_nextPosY s
*/
private void drawnBallPosInNextRound(int f_nextPosX,int f_nextPosY)
Index: Visualization.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/visualization/Visualization.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** Visualization.java 8 Jul 2002 22:24:41 -0000 1.19
--- Visualization.java 13 Jul 2002 16:21:51 -0000 1.20
***************
*** 38,44 ****
* This is the constructor of Visualization class
*
! * @param f_myWorld
! * @param f_teamName
! * @param f_playerNumber
*/
public Visualization(WorldModel f_myWorld,String f_teamName, int f_playerNumber)
--- 38,44 ----
* This is the constructor of Visualization class
*
! * @param f_myWorld s
! * @param f_teamName s
! * @param f_playerNumber s
*/
public Visualization(WorldModel f_myWorld,String f_teamName, int f_playerNumber)
|
Update of /cvsroot/jais/jaisteam/src/jais/world
In directory usw-pr-cvs1:/tmp/cvs-serv32242/world
Modified Files:
WorldActionInformInterface.java WorldDataAccessInterface.java
WorldModel.java WorldUpdateInterface.java xWorldModel.java
Log Message:
added muchos vielos tabulatoros... jb 7.0 is really fine ;)
changed the handling of the enemy and own team lists:
the list is fetched at the beginning of the KI cycle and stored in an
internal reference (m_enemyTeam m_ownTeam).
Index: WorldActionInformInterface.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/world/WorldActionInformInterface.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** WorldActionInformInterface.java 7 Jul 2002 20:01:36 -0000 1.3
--- WorldActionInformInterface.java 13 Jul 2002 16:21:52 -0000 1.4
***************
*** 10,48 ****
{
/**
! * this method should inform the world about a catchBall action send to the server from the KI
! * @param f_angle
! */
! public void informCatchBall(double f_angle);
! /**
! * this method should inform the world about a dash action send to the server from the KI
! * @param f_power
! */
! public void informDash(double f_power);
! /**
! * this method should inform the world about a kick action send to the server from the KI
! * @param f_power
! * @param f_angle
! */
! public void informKick(double f_power, double f_angle);
! /**
! * this method should inform the world about a turnNeck action send to the server from the KI
! * @param f_angle
! */
! public void informTurnNeck(double f_angle);
! /**
! * this method should inform the world about a move action send to the server from the KI
! * @param f_x
! * @param f_y
! */
! public void informMove(double f_x, double f_y);
! /**
! * this method should inform the world about a turn action send to the server from the KI
! * @param f_angle
! */
! public void informTurn(double f_angle);
}
--- 10,48 ----
{
/**
! * this method should inform the world about a catchBall action send to the server from the KI
! * @param f_angle
! */
! public void informCatchBall(double f_angle);
! /**
! * this method should inform the world about a dash action send to the server from the KI
! * @param f_power
! */
! public void informDash(double f_power);
! /**
! * this method should inform the world about a kick action send to the server from the KI
! * @param f_power
! * @param f_angle
! */
! public void informKick(double f_power, double f_angle);
! /**
! * this method should inform the world about a turnNeck action send to the server from the KI
! * @param f_angle
! */
! public void informTurnNeck(double f_angle);
! /**
! * this method should inform the world about a move action send to the server from the KI
! * @param f_x
! * @param f_y
! */
! public void informMove(double f_x, double f_y);
! /**
! * this method should inform the world about a turn action send to the server from the KI
! * @param f_angle
! */
! public void informTurn(double f_angle);
}
Index: WorldDataAccessInterface.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/world/WorldDataAccessInterface.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** WorldDataAccessInterface.java 7 Jul 2002 22:24:16 -0000 1.7
--- WorldDataAccessInterface.java 13 Jul 2002 16:21:52 -0000 1.8
***************
*** 13,171 ****
public interface WorldDataAccessInterface
{
! /**
! * gives the simulation cycle in which we are
! * @return int cycle
! */
! public int sorry_whatTimeDoWeHave();
! /**
! * gives the playerinfos about the enemys
! * @return Arraylist playerinfos
! * @roseuid 3CE8BBA70270
! */
! public ArrayList getEnemyPlayers();
! /**
! * gives the playerinfos about our team
! * @return ArrayList playerinfos
! * @roseuid 3CE8BBB401E3
! */
! public ArrayList getFriendlyPlayers();
! /**
! * gives the playmode in which we are
! * @return int playmode
! * @roseuid 3CE8BBBF03DD
! */
! public int getPlaymode();
! /**
! * gives the last SenseBodyInfo we get
! * @return SenseBodyInfo
! * @roseuid 3CE8BBC80047
! */
! public SenseBodyInfo getSenseBodyInfo();
! /**
! * gives the last BallInfo we get
! * @return BallInfo
! * @roseuid 3CE8BBDC0028
! */
! public BallInfo getBall();
! /**
! * gives the last Playerinfo about our agent
! * @return Playerinfo
! * @roseuid 3CE8BBE10061
! */
! public PlayerInfo getMyself();
! /**
! * gives the last RefereeMessage that arrived (blocks until there was one)
! * @return AurealInfo RefereeMessage
! */
! public AurealInfo getLastRefereeMessage();
! /**
! * gives the last SayMessage from a player that arrived
! * @return AurealInfo SayMessage
! */
! public AurealInfo getLastPlayerMessage();
/**
! * gives the last SayMessage from our coach that arrived
! * @return AurealInfo SayMessage
! */
! public AurealInfo getLastCoachMessage();
! /**
! * says if we play on leftside or rightside
! * @return true for left, false for right
! */
! boolean isPlayingLeft();
! /**
! * gives the absolute viewAngle from our Agent to the x-Axis
! * @return double viewAngle in degrees
! */
! public double getAbsViewAngle();
! /**
! * gives the absolute bodyDirection from our Agent to the x-Axis
! * @return double bodyDirection in degrees
! */
! public double getAbsBodyDir();
! /**
! * gives the angle from our bodyDirection to an object
! * @param f_obj is the object to which we want our BodyDirection
! * @return double bodyDirection in degrees
! */
! public double getBodyDirectionTo(ObjectInfo f_obj);
/**
! * gives the angle from our bodyDirection to an object
! * @param f_obj is the coordinate to which we want our BodyDirection
! * @return double bodyDirection in degrees
! */
! public double getBodyDirectionTo(Coordinate f_obj);
! /**
! * gives the angle from our neck to our body
! * @return double neckDirection in degrees
! */
! public double getNeckDirection();
! /**
! * gives the distance from our agent to coordinates
! * @param f_coord
! * @return double MyDistanceTo
! */
! public double getMyDistanceTo(Coordinate f_coord);
! /**
! * gives the distance from our agent to an object
! * @param f_object
! * @return double MyDistanceTo
! */
! public double getMyDistanceTo(ObjectInfo f_object);
! /**
! * gives the viewMode
! * @return String viewMode
! */
! public String getViewMode();
! /**************************************************************************************************/
/* Here follow methods provided for the visualization of our WorldModel
! /**************************************************************************************************/
! /**
! * gives the flags we saw this round (without them we used for calculating our Position)
! * @return LinkedList seenFlags
! */
! public LinkedList getCurrentylSeenFlags();
/**
! * gives the flags we used this round for calculating our Position
! * @return LinkedList usedFlags
! */
! public LinkedList getCurrentylUsedFlags();
! /**
! * gives the lines we saw this round
! * @return LinkedList seenLines
! */
! public LinkedList getCurrentylSeenLines();
! /**
! * gives the lines we used this round for calculating our Position
! * @return LinkedList usedLines
! */
! public LinkedList getCurrentylUsedLines();
! /**
! * gives the goals we saw this round
! * @return LinkedList seenGoals
! */
! public LinkedList getCurrentylSeenGoals();
! }
--- 13,171 ----
public interface WorldDataAccessInterface
{
! /**
! * gives the simulation cycle in which we are
! * @return int cycle
! */
! public int sorry_whatTimeDoWeHave();
! /**
! * gives the playerinfos about the enemys
! * @return Arraylist playerinfos
! * @roseuid 3CE8BBA70270
! */
! public ArrayList getEnemyPlayers();
! /**
! * gives the playerinfos about our team
! * @return ArrayList playerinfos
! * @roseuid 3CE8BBB401E3
! */
! public ArrayList getFriendlyPlayers();
! /**
! * gives the playmode in which we are
! * @return int playmode
! * @roseuid 3CE8BBBF03DD
! */
! public int getPlaymode();
! /**
! * gives the last SenseBodyInfo we get
! * @return SenseBodyInfo
! * @roseuid 3CE8BBC80047
! */
! public SenseBodyInfo getSenseBodyInfo();
! /**
! * gives the last BallInfo we get
! * @return BallInfo
! * @roseuid 3CE8BBDC0028
! */
! public BallInfo getBall();
! /**
! * gives the last Playerinfo about our agent
! * @return Playerinfo
! * @roseuid 3CE8BBE10061
! */
! public PlayerInfo getMyself();
! /**
! * gives the last RefereeMessage that arrived (blocks until there was one)
! * @return AurealInfo RefereeMessage
! */
! public AurealInfo getLastRefereeMessage();
! /**
! * gives the last SayMessage from a player that arrived
! * @return AurealInfo SayMessage
! */
! public AurealInfo getLastPlayerMessage();
/**
! * gives the last SayMessage from our coach that arrived
! * @return AurealInfo SayMessage
! */
! public AurealInfo getLastCoachMessage();
! /**
! * says if we play on leftside or rightside
! * @return true for left, false for right
! */
! boolean isPlayingLeft();
! /**
! * gives the absolute viewAngle from our Agent to the x-Axis
! * @return double viewAngle in degrees
! */
! public double getAbsViewAngle();
! /**
! * gives the absolute bodyDirection from our Agent to the x-Axis
! * @return double bodyDirection in degrees
! */
! public double getAbsBodyDir();
! /**
! * gives the angle from our bodyDirection to an object
! * @param f_obj is the object to which we want our BodyDirection
! * @return double bodyDirection in degrees
! */
! public double getBodyDirectionTo(ObjectInfo f_obj);
/**
! * gives the angle from our bodyDirection to an object
! * @param f_obj is the coordinate to which we want our BodyDirection
! * @return double bodyDirection in degrees
! */
! public double getBodyDirectionTo(Coordinate f_obj);
! /**
! * gives the angle from our neck to our body
! * @return double neckDirection in degrees
! */
! public double getNeckDirection();
! /**
! * gives the distance from our agent to coordinates
! * @param f_coord h
! * @return double MyDistanceTo
! */
! public double getMyDistanceTo(Coordinate f_coord);
! /**
! * gives the distance from our agent to an object
! * @param f_object h
! * @return double MyDistanceTo
! */
! public double getMyDistanceTo(ObjectInfo f_object);
! /**
! * gives the viewMode
! * @return String viewMode
! */
! public String getViewMode();
! /**************************************************************************************************/
/* Here follow methods provided for the visualization of our WorldModel
! /**************************************************************************************************/
! /**
! * gives the flags we saw this round (without them we used for calculating our Position)
! * @return LinkedList seenFlags
! */
! public LinkedList getCurrentylSeenFlags();
/**
! * gives the flags we used this round for calculating our Position
! * @return LinkedList usedFlags
! */
! public LinkedList getCurrentylUsedFlags();
! /**
! * gives the lines we saw this round
! * @return LinkedList seenLines
! */
! public LinkedList getCurrentylSeenLines();
! /**
! * gives the lines we used this round for calculating our Position
! * @return LinkedList usedLines
! */
! public LinkedList getCurrentylUsedLines();
! /**
! * gives the goals we saw this round
! * @return LinkedList seenGoals
! */
! public LinkedList getCurrentylSeenGoals();
! }
\ No newline at end of file
Index: WorldModel.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/world/WorldModel.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** WorldModel.java 8 Jul 2002 06:37:55 -0000 1.55
--- WorldModel.java 13 Jul 2002 16:21:52 -0000 1.56
***************
*** 16,53 ****
public class WorldModel implements WorldUpdateInterface, WorldDataAccessInterface, WorldActionInformInterface
{
! private static Logger logger=Logger.getLogger("jais.world"); // get our logger
! protected BallInfo m_ball; // where the ball is stored
! private String m_teamName; // where the teamName is stored
! private int m_playerNumber; // where the playerNumber is stored
! private final int FORGET_TIME= 1*10; // x-seconds
! private final double NOT_MOVING=0.01; // if deltaVector is smaller than we say Object did not move
[...1746 lines suppressed...]
! * Sets a whole ObjectInfo list to visible true or false
! * @param f_objectInfoList list to modify
! * @param f_isVisible set visibility of the Objects in list to true or false
! * @return the given List with all objectInfos in it with isVisible()==f_isVisible
! */
! private ArrayList setVisible(ArrayList f_objectInfoList, boolean f_isVisible)
! {
ObjectInfo l_object;
int l_index;
for (ListIterator it=f_objectInfoList.listIterator();it.hasNext();)
{
! l_index=it.nextIndex();it.next();
! l_object=(ObjectInfo)f_objectInfoList.get(l_index);
! l_object.setVisible(f_isVisible);
! f_objectInfoList.set(l_index,l_object);
}
return f_objectInfoList;
! }
! }
\ No newline at end of file
Index: WorldUpdateInterface.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/world/WorldUpdateInterface.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** WorldUpdateInterface.java 7 Jul 2002 20:01:37 -0000 1.3
--- WorldUpdateInterface.java 13 Jul 2002 16:21:52 -0000 1.4
***************
*** 11,39 ****
public interface WorldUpdateInterface
{
! /**
! * determs the type of sender and stores the AurealInfo in the corresponding list
! * @param f_hearEvent
! * @roseuid 3CE8BB580190
! */
! public void updateAurealInfo(HearEvent f_hearEvent);
! /**
! * determs the type of object and stores the VisualInfo in the corresponding list
! * @param f_visualEvent
! * @roseuid 3CE8BB6E020A
! */
! public void updateVisualInfo(VisualEvent f_visualEvent);
! /**
! * stores the SenseBodyInfo in the corresponding list
! * @param f_senseBodyEvent
! * @roseuid 3CE8BB8401D0
! */
! public void updateSenseBodyInfo(SenseBodyEvent f_senseBodyEvent);
! /**
! * initialized playingside, backnumber and playmode
! * @param f_InitialEvent
! */
! public void updateInitInfo(InitialEvent f_InitialEvent);
! }
--- 11,39 ----
public interface WorldUpdateInterface
{
! /**
! * determs the type of sender and stores the AurealInfo in the corresponding list
! * @param f_hearEvent hghg
! * @roseuid 3CE8BB580190
! */
! public void updateAurealInfo(HearEvent f_hearEvent);
! /**
! * determs the type of object and stores the VisualInfo in the corresponding list
! * @param f_visualEvent
! * @roseuid 3CE8BB6E020A
! */
! public void updateVisualInfo(VisualEvent f_visualEvent);
! /**
! * stores the SenseBodyInfo in the corresponding list
! * @param f_senseBodyEvent
! * @roseuid 3CE8BB8401D0
! */
! public void updateSenseBodyInfo(SenseBodyEvent f_senseBodyEvent);
! /**
! * initialized playingside, backnumber and playmode
! * @param f_InitialEvent
! */
! public void updateInitInfo(InitialEvent f_InitialEvent);
! }
\ No newline at end of file
Index: xWorldModel.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/world/xWorldModel.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** xWorldModel.java 7 Jul 2002 20:01:37 -0000 1.3
--- xWorldModel.java 13 Jul 2002 16:21:52 -0000 1.4
***************
*** 9,19 ****
public class xWorldModel extends Throwable
{
! /**
! * @roseuid 3CEB62610320
! * @param f_message
! */
! public xWorldModel(String f_message)
! {
super(f_message);
! }
! }
--- 9,19 ----
public class xWorldModel extends Throwable
{
! /**
! * @roseuid 3CEB62610320
! * @param f_message
! */
! public xWorldModel(String f_message)
! {
super(f_message);
! }
! }
\ No newline at end of file
|
|
From: <mae...@us...> - 2002-07-13 16:21:54
|
Update of /cvsroot/jais/jaisteam/src/jais/communication
In directory usw-pr-cvs1:/tmp/cvs-serv32242/communication
Modified Files:
Communication.java Event.java PlayerStuffInterface.java
SenseBodyEvent.java
Log Message:
added muchos vielos tabulatoros... jb 7.0 is really fine ;)
changed the handling of the enemy and own team lists:
the list is fetched at the beginning of the KI cycle and stored in an
internal reference (m_enemyTeam m_ownTeam).
Index: Communication.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/Communication.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** Communication.java 9 Jul 2002 09:32:38 -0000 1.29
--- Communication.java 13 Jul 2002 16:21:51 -0000 1.30
***************
*** 19,687 ****
public class Communication extends Thread implements ConnectionStuffInterface, PlayerStuffInterface
{
! private String m_serverName; // name of robucup server which will be resolved
! private int m_serverPort; // port of the robocup server
! private String m_teamName; // name of the team to connect
! private boolean m_isGoalie; // wether the player to connect is goalie or not
! private InetAddress m_serverAddress; // the resolved server adress
! private DatagramSocket m_socket; // new datagram socket
! private String m_stuffToSendToServer; // catches every message which has to
! // be sent to server
[...1310 lines suppressed...]
! /**
! * This method stops the thread method (receiveDataFromServer) which
! * receives data from the server
! */
! private synchronized void stopThread()
! {
! m_thisThread=null;
! }
!
!
! /**
! * This method frees the binded system resources after terminating
! * the player.
! */
! public void finalize()
! {
! logger.info("Ok, closing my socket!");
! }
! }
\ No newline at end of file
Index: Event.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/Event.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Event.java 9 Jul 2002 01:16:51 -0000 1.5
--- Event.java 13 Jul 2002 16:21:51 -0000 1.6
***************
*** 11,41 ****
public abstract class Event
{
! protected ArrayList m_objects;
! protected String m_message;
! /**
! * In this method the unparsed message is delivered
! * @param f_message contains unparsed string
! * @roseuid 3CEB63BA034E
! */
! public Event(String f_message)
! {
m_message=f_message;
! }
! /**
! * This method delivers the parsed message as objects in form of a arraylist
! * @return java.util.ArrayList
! * @roseuid 3CEA8ADC007E
! */
! public ArrayList getObjects()
! {
! return m_objects;
! }
! /**
! * @param f_message
! * @roseuid 3CEA8B7F0032
! */
! public abstract void parseData();
! }
--- 11,41 ----
public abstract class Event
{
! protected ArrayList m_objects;
! protected String m_message;
! /**
! * In this method the unparsed message is delivered
! * @param f_message contains unparsed string
! * @roseuid 3CEB63BA034E
! */
! public Event(String f_message)
! {
m_message=f_message;
! }
! /**
! * This method delivers the parsed message as objects in form of a arraylist
! * @return java.util.ArrayList
! * @roseuid 3CEA8ADC007E
! */
! public ArrayList getObjects()
! {
! return m_objects;
! }
! /**
! * @param f_message
! * @roseuid 3CEA8B7F0032
! */
! public abstract void parseData();
! }
\ No newline at end of file
Index: PlayerStuffInterface.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/PlayerStuffInterface.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** PlayerStuffInterface.java 17 Jun 2002 20:48:52 -0000 1.4
--- PlayerStuffInterface.java 13 Jul 2002 16:21:51 -0000 1.5
***************
*** 14,108 ****
public interface PlayerStuffInterface
{
! /**
! * This method provides the possibility to send to the server for the goalie
! * the cath command
! *
! * @roseuid 3CEA1B0403E4
! *
! * @param f_direction
! *
! * @throws xCommunication
! */
! public void catchBall(double f_direction) throws xCommunication;
! /**
! * This method provides the possibility to send to the server dash
! * commands.
! *
! * @roseuid 3CEA1AF4021F
! *
! * @param f_dashPower
! *
! * @throws xCommunication
! */
! public void dash(double f_dashPower) throws xCommunication;
! /**
! * This method provides the possibility to send to the server kick command.
! *
! * @roseuid 3CEA1AFB00D4
! *
! * @param f_kickPower
! * @param f_kickAngel
! *
! * @throws xCommunication
! */
! public void kick(double f_kickPower, double f_kickAngel) throws xCommunication;
! /**
! * This method provides the possibility to send to the server turn neck command
! *
! * @roseuid 3CEA1AEB0103
! *
! * @param f_turnNeckAngel
! *
! * @throws xCommunication
! */
! public void turnNeck(double f_turnNeckAngel) throws xCommunication;
! /**
! * This method provides the possibility to send to the server move to (x,y)
! * command for befor kick off playmode.
! *
! * @roseuid 3CEA1ADB013C
! *
! * @param f_moveToXPos
! * @param f_moveToYPos
! *
! * @throws xCommunication
! *
! */
! public void move(double f_moveToXPos, double f_moveToYPos) throws xCommunication;
! /**
! * This method provides the possibility to send to the server trun body command.
! *
! * @roseuid 3CEA1AE702F2
! *
! * @param f_turnAngel
! *
! * @throws xCommunication
! */
! public void turn(double f_turnAngel) throws xCommunication;
! /**
! * This method provides the possibility to send to the server say message.
! *
! * @roseuid 3CEA1B0B0240
! *
! * @param f_sayMessage
! *
! * @throws xCommunication
! */
! public void say(String f_sayMessage) throws xCommunication;
! /**
* This method provides the option to send change view actions to the server
* f_width has to element of: {narrow; normal; wide} and
--- 14,108 ----
public interface PlayerStuffInterface
{
! /**
! * This method provides the possibility to send to the server for the goalie
! * the cath command
! *
! * @roseuid 3CEA1B0403E4
! *
! * @param f_direction
! *
! * @throws xCommunication
! */
! public void catchBall(double f_direction) throws xCommunication;
! /**
! * This method provides the possibility to send to the server dash
! * commands.
! *
! * @roseuid 3CEA1AF4021F
! *
! * @param f_dashPower
! *
! * @throws xCommunication
! */
! public void dash(double f_dashPower) throws xCommunication;
! /**
! * This method provides the possibility to send to the server kick command.
! *
! * @roseuid 3CEA1AFB00D4
! *
! * @param f_kickPower
! * @param f_kickAngel
! *
! * @throws xCommunication
! */
! public void kick(double f_kickPower, double f_kickAngel) throws xCommunication;
! /**
! * This method provides the possibility to send to the server turn neck command
! *
! * @roseuid 3CEA1AEB0103
! *
! * @param f_turnNeckAngel
! *
! * @throws xCommunication
! */
! public void turnNeck(double f_turnNeckAngel) throws xCommunication;
! /**
! * This method provides the possibility to send to the server move to (x,y)
! * command for befor kick off playmode.
! *
! * @roseuid 3CEA1ADB013C
! *
! * @param f_moveToXPos
! * @param f_moveToYPos
! *
! * @throws xCommunication
! *
! */
! public void move(double f_moveToXPos, double f_moveToYPos) throws xCommunication;
! /**
! * This method provides the possibility to send to the server trun body command.
! *
! * @roseuid 3CEA1AE702F2
! *
! * @param f_turnAngel
! *
! * @throws xCommunication
! */
! public void turn(double f_turnAngel) throws xCommunication;
! /**
! * This method provides the possibility to send to the server say message.
! *
! * @roseuid 3CEA1B0B0240
! *
! * @param f_sayMessage
! *
! * @throws xCommunication
! */
! public void say(String f_sayMessage) throws xCommunication;
! /**
* This method provides the option to send change view actions to the server
* f_width has to element of: {narrow; normal; wide} and
***************
*** 114,118 ****
* @throws xCommunication
*/
! public void changeView(String f_width , boolean f_highViewQuality) throws xCommunication;
! }
--- 114,118 ----
* @throws xCommunication
*/
! public void changeView(String f_width , boolean f_highViewQuality) throws xCommunication;
! }
\ No newline at end of file
Index: SenseBodyEvent.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/SenseBodyEvent.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SenseBodyEvent.java 8 Jul 2002 07:17:57 -0000 1.8
--- SenseBodyEvent.java 13 Jul 2002 16:21:51 -0000 1.9
***************
*** 14,41 ****
public class SenseBodyEvent extends Event
{
! private static Logger logger=Logger.getLogger("jais.communication"); //get our logger
! /**
! * @roseuid 3CEB63BD0009
! *
! * this method is called by the Communication class
! * it produces the arraylist and calls the parsing method
! */
! public SenseBodyEvent(String f_message)
! {
super(f_message);
m_objects=new ArrayList(1);
parseData();
! }
! /**
! * @param f_message
! * @roseuid 3CEB63BD000A
! *
! * this method is called by the SenseBodyEvent method. it parses the message
! * and stores the elements in the arrylist
! */
! public void parseData()
! {
SenseBodyInfo l_sense_body_info = new SenseBodyInfo();
StringTokenizer l_tokenizer = new StringTokenizer(m_message,"() ");
--- 14,41 ----
public class SenseBodyEvent extends Event
{
! private static Logger logger=Logger.getLogger("jais.communication"); //get our logger
! /**
! * @roseuid 3CEB63BD0009
! *
! * this method is called by the Communication class
! * it produces the arraylist and calls the parsing method
! */
! public SenseBodyEvent(String f_message)
! {
super(f_message);
m_objects=new ArrayList(1);
parseData();
! }
! /**
! * @param f_message
! * @roseuid 3CEB63BD000A
! *
! * this method is called by the SenseBodyEvent method. it parses the message
! * and stores the elements in the arrylist
! */
! public void parseData()
! {
SenseBodyInfo l_sense_body_info = new SenseBodyInfo();
StringTokenizer l_tokenizer = new StringTokenizer(m_message,"() ");
***************
*** 44,96 ****
try
{
! l_tokenizer.nextToken(); // token 'sense_body'
! l_sense_body_info.m_time = Integer.parseInt(l_tokenizer.nextToken()); // element time
! l_tokenizer.nextToken(); // token 'view_mode'
! l_sense_body_info.m_viewQuality = l_tokenizer.nextToken(); // element view quality
! l_sense_body_info.m_viewMode = l_tokenizer.nextToken(); // element view mode
! l_tokenizer.nextToken(); // token 'stamina'
! l_sense_body_info.m_stamina = Double.parseDouble(l_tokenizer.nextToken()); // element stamina
! l_sense_body_info.m_effort = Double.parseDouble(l_tokenizer.nextToken()); // element effort
! l_tokenizer.nextToken(); // token 'speed'
! l_sense_body_info.m_amountOfSpeed = Double.parseDouble(l_tokenizer.nextToken()); // element amount of speed
! l_sense_body_info.m_directionOfSpeed = Integer.parseInt(l_tokenizer.nextToken()); // element direction of speed
! l_tokenizer.nextToken(); // token 'head_angle'
! l_sense_body_info.m_neckDirection = Integer.parseInt(l_tokenizer.nextToken()); // element head angle
! l_tokenizer.nextToken(); // token 'kick'
! l_sense_body_info.m_kickCount = Integer.parseInt(l_tokenizer.nextToken()); // element kick count
! l_tokenizer.nextToken(); // token 'dash'
! l_sense_body_info.m_dashCount = Integer.parseInt(l_tokenizer.nextToken()); // element dash count
! l_tokenizer.nextToken(); // token 'turn'
! l_sense_body_info.m_turnCount = Integer.parseInt(l_tokenizer.nextToken()); // element turn count
! l_tokenizer.nextToken(); // token 'say'
! l_sense_body_info.m_sayCount = Integer.parseInt(l_tokenizer.nextToken()); // element say count
! l_tokenizer.nextToken(); // token 'turn_neck'
! l_sense_body_info.m_turnNeckCount = Integer.parseInt(l_tokenizer.nextToken()); // element turn neck count
! l_tokenizer.nextToken(); // token 'catch'
! l_sense_body_info.m_catchCount = Integer.parseInt(l_tokenizer.nextToken()); // element catch count
! l_tokenizer.nextToken(); // token 'move'
! l_sense_body_info.m_moveCount = Integer.parseInt(l_tokenizer.nextToken()); // element move count
! l_tokenizer.nextToken(); // token 'change_view'
! l_sense_body_info.m_changeViewCount = Integer.parseInt(l_tokenizer.nextToken()); // element change view count
! m_objects.add(l_sense_body_info); // elements are inserted into the list
}
catch(Exception e)
{
! logger.info("Error parsing see message :"+e.getMessage());
}
! }
! }
--- 44,96 ----
try
{
! l_tokenizer.nextToken(); // token 'sense_body'
! l_sense_body_info.m_time = Integer.parseInt(l_tokenizer.nextToken()); // element time
! l_tokenizer.nextToken(); // token 'view_mode'
! l_sense_body_info.m_viewQuality = l_tokenizer.nextToken(); // element view quality
! l_sense_body_info.m_viewMode = l_tokenizer.nextToken(); // element view mode
! l_tokenizer.nextToken(); // token 'stamina'
! l_sense_body_info.m_stamina = Double.parseDouble(l_tokenizer.nextToken()); // element stamina
! l_sense_body_info.m_effort = Double.parseDouble(l_tokenizer.nextToken()); // element effort
! l_tokenizer.nextToken(); // token 'speed'
! l_sense_body_info.m_amountOfSpeed = Double.parseDouble(l_tokenizer.nextToken()); // element amount of speed
! l_sense_body_info.m_directionOfSpeed = Integer.parseInt(l_tokenizer.nextToken()); // element direction of speed
! l_tokenizer.nextToken(); // token 'head_angle'
! l_sense_body_info.m_neckDirection = Integer.parseInt(l_tokenizer.nextToken()); // element head angle
! l_tokenizer.nextToken(); // token 'kick'
! l_sense_body_info.m_kickCount = Integer.parseInt(l_tokenizer.nextToken()); // element kick count
! l_tokenizer.nextToken(); // token 'dash'
! l_sense_body_info.m_dashCount = Integer.parseInt(l_tokenizer.nextToken()); // element dash count
! l_tokenizer.nextToken(); // token 'turn'
! l_sense_body_info.m_turnCount = Integer.parseInt(l_tokenizer.nextToken()); // element turn count
! l_tokenizer.nextToken(); // token 'say'
! l_sense_body_info.m_sayCount = Integer.parseInt(l_tokenizer.nextToken()); // element say count
! l_tokenizer.nextToken(); // token 'turn_neck'
! l_sense_body_info.m_turnNeckCount = Integer.parseInt(l_tokenizer.nextToken()); // element turn neck count
! l_tokenizer.nextToken(); // token 'catch'
! l_sense_body_info.m_catchCount = Integer.parseInt(l_tokenizer.nextToken()); // element catch count
! l_tokenizer.nextToken(); // token 'move'
! l_sense_body_info.m_moveCount = Integer.parseInt(l_tokenizer.nextToken()); // element move count
! l_tokenizer.nextToken(); // token 'change_view'
! l_sense_body_info.m_changeViewCount = Integer.parseInt(l_tokenizer.nextToken()); // element change view count
! m_objects.add(l_sense_body_info); // elements are inserted into the list
}
catch(Exception e)
{
! logger.info("Error parsing see message :"+e.getMessage());
}
! }
! }
\ No newline at end of file
|