예제 #1
0
int main(int argc, char *argv[])
{
    Loc x(1);
    Loc y(5);
    Direction dir(0);
    char        *ratName;

	signal(SIGHUP, quit);
	signal(SIGINT, quit);
	signal(SIGTERM, quit);

	if (argc >= 2)
		ratName = strdup(argv[1]);
	else
		getName("Welcome to CS244B MazeWar!\n\nYour Name", &ratName);

	M = MazewarInstance::mazewarInstanceNew(string(ratName));
	MazewarInstance* a = M.ptr();
	strncpy(M->myName_, ratName, NAMESIZE);
	free(ratName);

	MazeInit(argc, argv);

	mws_add_rat(M->state, &M->local_id, MY_X_LOC, MY_Y_LOC, MY_MW_DIR_T,
	                      M->myName_);
	mws_set_local_rat(M->state, M->local_id);

	play();

	return (0);
}
예제 #2
0
/* ----------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
	Loc x(1);
	Loc y(5);
	Direction dir(0);
	char *ratName;	
	signal(SIGHUP, quit);
	signal(SIGINT, quit);
	signal(SIGTERM, quit);
	struct timeval zero;
	struct timeval now;
	gettimeofday(&now, NULL);
	start_time = time_diff(now, zero);

	getName("Welcome to CS244B MazeWar!\n\nYour Name", &ratName);
	ratName[strlen(ratName)-1] = 0;

	M = MazewarInstance::mazewarInstanceNew(string(ratName));
	MazewarInstance* a = M.ptr();
	strncpy(M->myName_, ratName, NAMESIZE);
	free(ratName);

	MazeInit(argc, argv);
	NewPosition(M);
	play();

	return 0;
}