/**************************************************************************** xt-bot-b.cpp Einfacher Roboter in C++. Er verfolgt seine Gegner faehrt nicht gegen Waende, sammelt Keckse und Versucht die Minen zu zerschiessen, allerdings hat er leichte Ladehemmungen. Copyright (C) 2001 xt changed by Falko Menge (20. Nov 2004): I fixed the bug of the self-termination after the first game. Now it resets itsself after every game. In this version called "xt2-bot B" I tweaked the algorithm of the "xt2-bot A". This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ****************************************************************************/ #include #include #include #include #include #include #include using std::cout; using std::cin; using std::endl; void message(int); class bot { public: int Initialize; char YourName[80]; int YourColour; int GameOption_Optionsnummer; double GameOption_value; double Radar_Entfernung; int Radar_typ; double Radar_Winkel; double Info_Zeit; double Info_Geschwindigkeit; double Info_Kanonen_Winkel; double RobotInfo_Energie_Level; int RobotInfo_Team_Mitglied; int RotationReached_wer; double Energy_Level; int RobotsLeft_anz; int Collision_typ; double Collision_winkel; int Warning_typ; char Warning_string[80]; double fahr_winkel; //public: bot(){ fahr_winkel = 0.0; } void init(); void options(); void nachricht(); void debug(char *); void print(char *); void beschleunigen(double); void rotateamount(int, double, double); void sweep(int,double,double,double); }; void bot::sweep(int was, double velocty, double left, double right) { cout<<"Sweep "<>typ; if(!strcmp(typ,"Initialize")) cin>>Initialize; else if(!strcmp(typ,"YourName")) cin>>YourName; else if(!strcmp(typ,"GameOption")) cin>>GameOption_Optionsnummer>>GameOption_value; // that line seems to be wrong because there is more than one option else if(!strcmp(typ,"GameStarts")) ; else if(!strcmp(typ,"Radar")) { cin>>Radar_Entfernung>>Radar_typ>>Radar_Winkel; if(Radar_typ == 0) { if(Radar_Winkel < -0.3||Radar_Winkel > 0.3) { if(Radar_Winkel > 0) { if(Radar_Entfernung > 6) cout<<"RotateAmount "<<1<<" "<<7<<" "<<0.4<6) cout<<"RotateAmount "<<1<<" "<<7<<" "<<-0.4< -0.4&&Radar_Winkel<0.4) { cout<<"Debug gegner! winkel:"< -0.4 && Radar_Winkel < 0.4 && Radar_Entfernung < 7) //wand seite cout<<"RotateAmount "<<1<<" "<<7<<" "<<0.1< -0.4 && Radar_Winkel < 0.4 && Radar_Entfernung < 2) // wand frontal cout<<"RotateAmount "<<1<<" "<<7<<" "<<0.7< -0.1 && Radar_Winkel < 0.2 && Radar_Entfernung < 0.01) //stehe an der wand cout<<"RotateAmount "<<1<<" "<<7<<" "<<1< -0.3&&Radar_Winkel < 0.3 ) { cout<<"DebugCircle "< 0.3) cout<<"RotateAmount "<<1<<" "<<7<<" "<<0.9<>Info_Zeit; cin>>Info_Geschwindigkeit; cin>>Info_Kanonen_Winkel; } else if(!strcmp(typ,"RobotInfo")) { cin>>RobotInfo_Energie_Level>>RobotInfo_Team_Mitglied; cout<<"Debug der gegner hat noch "<>RotationReached_wer; else if(!strcmp(typ,"Energy")) { cin>>Energy_Level; //cout<<"Debug ich habe noch:"<>RobotsLeft_anz; else if(!strcmp(typ,"Collision")) { cin>>Collision_typ; cin>>Collision_winkel; } else if(!strcmp(typ,"Warning")) { cin>>Warning_typ; cin>>Warning_string[80]; cout<<"Debug "<