⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 robocuo相关资料robocuo相关资料
💻 CPP
字号:
#include <sys/types.h>#include <sys/stat.h>#include <iostream>#include <fstream>#include <cstring>#include "decision.h"#include "connection.h"#include "world.h"#include "body.h"#include "parse.h"using namespace std;int main( int argc, char **argv ){	/*	TrajectoryBackWard *bw=new TrajectoryBackWard;	bw->BackWard();	bw->save(cout);	TurnTo *tr=new TurnTo;	tr->TurnToLR();	tr->save(cout);	Trajectory *wk=new Trajectory;	wk->Walk();	wk->save(cout);	*/	/*	ifstream fin("all.rad");	action act;	while(act.load(fin))	{		act.save(cout);	}	*///	freopen("/dev/null","w",stdout);//	freopen("/dev/null","w",stderr);	mkfifo("/tmp/trainer_pipe",0666);	unsigned port = 3100;	char host_addr[128] = "127.0.0.1";	const char *strTmp;	bool error = false;	for( int i = 1; i < argc && !error; i ++ )	{		if( i + 1 == argc )			error = true;		else if( !strcmp( argv[i], "--host" ) )			strcpy( host_addr, argv[++i] );		else if( !strcmp( argv[i], "--port" ) )			port = atoi(argv[++i]);		else			error = true;	}	if( error )	{		cout << "Usage : " << argv[0] << " [Options]" << endl;		cout << "Options : " << endl;		cout << "  --host hostname : Set hostname to connect to server" << endl;		cout << "  --port portnum  : Set portnumber to connect to server" << endl;		cout << endl;		return 1;	}	connection *cn = new connection;	cn->connect_to(host_addr, port);	world *wm = new world;	body *bd = new body(wm);	wm -> bd = bd;	decision *me = new decision(wm, bd, cn);	string server_msg;	while( true )	{		me->act();		cn->receive( server_msg );		analyze_server_message( server_msg, wm, bd );		wm->analyze();		bd->analyze();	}	cn->disconnect();	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -