ProgrammierMethodik 2002 - RoboCup

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

RCPlayer.java

Go to the documentation of this file.
00001 /*
00002  * $Id: RCPlayer_8java-source.html,v 1.2 2002/07/07 20:59:52 stork Exp $
00003  *
00004  * $Log: RCPlayer_8java-source.html,v $
00004  * Revision 1.2  2002/07/07 20:59:52  stork
00004  * update dokumenation
00004  *
00005  * Revision 1.11  2002/07/06 13:18:43  transier
00006  * add Goalie support
00007  *
00008  * Revision 1.10  2002/07/05 18:34:08  stork
00009  * update dokumentation
00010  *
00011  * Revision 1.9  2002/07/03 17:23:38  stork
00012  * add some debug messages
00013  *
00014  * Revision 1.8  2002/07/02 20:56:19  stork
00015  * add support for central Log
00016  *
00017  * Revision 1.7  2002/06/22 20:15:41  stork
00018  * add some more dokumentation
00019  *
00020  * Revision 1.6  2002/06/07 18:16:58  stork
00021  * add display support handling
00022  *
00023  * Revision 1.5  2002/05/30 15:37:16  stork
00024  * improve handling when server dies before we
00025  *
00026  * Revision 1.4  2002/05/29 21:08:05  stork
00027  * new config file syntax
00028  *
00029  * Revision 1.3  2002/05/25 22:05:35  stork
00030  * add thread support
00031  *
00032  * Revision 1.2  2002/05/21 20:57:14  stork
00033  * first communicator version
00034  *
00035  * Revision 1.1.1.1  2002/05/21 20:32:05  stork
00036  * empty project
00037  *
00038  */
00039 
00044 public class RCPlayer extends Thread{
00046     public RCDisplay Display;
00047     public RCWorld World;
00048     public RCBrain Brain;
00049     public RCCommunicator Communicator;
00050     public RCLog Log;
00051     
00062     public RCPlayer (String TeamName, 
00063                      boolean Visual, 
00064                      String Hostname, 
00065                      int Port, 
00066                      boolean Goalie,
00067                      float X1,
00068                      float Y1,
00069                      float X2,
00070                      float Y2,
00071                      RCLog Log){
00072         // create a new world
00073         World = new RCWorld(Log);
00074         World.X1 = X1;
00075         World.Y1 = Y1;
00076         World.X2 = X2;
00077         World.Y2 = Y2;
00078 
00079         // create a new communicator
00080         Communicator = new RCCommunicator(TeamName, World, Goalie, Hostname, Port);
00081 
00082         // create a new display
00083         Display = new RCDisplay(World);
00084         World.setDisplay(Display);
00085         setVisible(Visual);
00086 
00087         // create a new brain
00088         if (Goalie)
00089                 Brain = new RCGoalieBrain(World, Communicator);      
00090         else
00091                 Brain = new RCBrain(World, Communicator);      
00092         World.setBrain(Brain);  
00093 
00094         this.Log = Log;
00095     }
00096 
00100     public void run (  ){
00101         boolean noError = true;
00102         while( (isInterrupted() == false) && (noError == true) ){
00103             Log.Log("Player-"+World.PlayerNumber+" : get a new message ********************");
00104             noError = Communicator.receive();
00105         }
00106     }
00107 
00113     public boolean isVisible(){
00114         return Display.isVisible();
00115     }
00116 
00122     public void setVisible( boolean Visible ){
00123         this.Display.setVisible( Visible );
00124     }
00125 }
00126 

(c) Copyright by Gruppe 1 :
  • Frederik Transier
  • Motitz Ritter
  • Oliver Strassburger
  • Sven Stork