自-我的第一个机器人足球程序

上传人:熠*** 文档编号:192128909 上传时间:2021-08-16 格式:DOC 页数:10 大小:35KB
返回 下载 相关 举报
自-我的第一个机器人足球程序_第1页
第1页 / 共10页
自-我的第一个机器人足球程序_第2页
第2页 / 共10页
自-我的第一个机器人足球程序_第3页
第3页 / 共10页
自-我的第一个机器人足球程序_第4页
第4页 / 共10页
自-我的第一个机器人足球程序_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《自-我的第一个机器人足球程序》由会员分享,可在线阅读,更多相关《自-我的第一个机器人足球程序(10页珍藏版)》请在金锄头文库上搜索。

1、我的第一个机器人足球程序(90行)(一)207-05-7 19:0/lii/ Stey.pp :Defins he entypn forthe DL pliion#includ sdafx.h#ilueStratgy.h#iclude mathhOOL APETRYDlMai( ANDLEodu, DWOR l_eson_for_call, LPVIlpeservd )witch(l_reaso_forcall) cae DL_PROCSSATTCH: cse DLL_TED_ATTACH: cs DLL_THREADDETAH: ase DLL_ROCEDETCH: eak;retr T;/

2、loba vaablsnsdouble P=3146;in WH= ; 1 bue yellowconsdouble MAL=112; /球场对角线长FILE *DEBUGFI; /调试文件Environment*EN;nt NDRTE5= 1, 1,1,, 1;/1 need, else odin D5 0;/巡逻方向,由 点1到 2duble TRACE62 = -,1,1,-1,-,-1,-1,1,-,-1,-1,-,-,-1,-,-,-1,-1,-1,-1,-1,-,-1; /纪录5 个机器人的轨迹double IPLACEENT6 0; /纪录每个机器人在1/ 秒内的位移n EV6

3、=;/estimate 估计的机器人的速度 an he blldoule CUNT1 =0,COUNT2 =; /保存调用次数dble BP2 0,0; /预测的球的坐标preiba postoin WIB = 5; /hreeis baldobeRBLENGH 3.2; /lengt f a rbot/baic meodvoi go(bt *robot, itID, const ouble x, const doube y); /朝某点运动vod Go(Rbot *robot,intID,onst dube x, cn ol y); /dbl roateT(bo *ro, it rID,co

4、st double desX, cost doueesY);/转动o stp(Rbo *bot, n I); 停止vodto(Root *obot,itI, dole x, duble y); 到某点静止voidbakTo(Robo roo, intrID,doublex, oble y); /反向到某点静止idetmateV(); /估计所有机器人的速度,a the llvoid pedictBll(duble s); /预测球的出现void run(Root *robot,int rID, intv,int vr);/advane methodsoidassBal(Rot *rotS, R

5、bt *robotG, int rIS, inrIG); /传球rtsen ,robot getvidpatl(Robot obo, ID, ouble 1, doule , double x2, doubl y2); /在 2点间晃动oinerBall(Robot *obot, itrI, doube x,dul ); /接近球,并且与 x,y 不在球的同一边vod kickal(Robt *robot, it rID, ouble x,doule y); /把球打到指定地点/statiesbool anShot(Root *robot, intrID);/是否可以用头撞球进 ca icso

6、tolcnRShoot(Robot *robot,nD);/是否可以旋转撞球进 otatnthreIsBa(); /判断球在哪个区域,返回区域编号bool asEnemyBe(Robot*robot, dubex, double y); /is hereenemybeenroo nd x,yvoi dfn(t wib); /void attck(n wib); /roe ctollervod witer(Robot robot, int rID, doube x, dobl); /在 x,y 点等待球,一旦 rxx,距离小于某值时kick ballvoi ctiveDefender(Robot

7、obot,it rID); /绕到球的右边ick bavoid negativeDende(Robotrbot, it rID, doe , doubl y); 首在某点并对着球,一旦距离小于某一值kckall,b.x xvd eepHeler(Robot robt, int rID);/协助守门员在球门的另一半守门,x 坐标小于守门员voidkeeper(Rootrot, int rD); /守门员,在固定 x 坐标跟着球的 y 坐标跑void ttaker(oot*robot, int rID);/绕到球的右边 ic bl/saegyfr allsateidstrategFoD(nvinm

8、en *env); /defult srategyForFB(nviromenv);void stategyFor(nvront *e);oidstraeyorPK(nviont env);vo straegyForFK(Environmet env);oid strateoGK(Enviromn *env);xernC STRATEGY_APIvod Creat ( nvironment env )/ alcte se dtand agn to en-era/ eg. en-uerDat ( vid ) ne ariabls ();xr C STRATG_API vdDestoy ( nvi

9、romt*ev)/ f ayser data td in Create (nviromet )/ g if (vurDta! NUL ) delee ( MyVarials * ) env-userData;exer C STRATEGY_PI vid ate ( Enviroment *env )/here are Strgies ,a thegame statediffrs calls te respndn metho CN2 +; e;stimateV();sitch(ev-gameSt) cse0 : sragyForD(env);break; ce REE_BALL : srateg

10、yForD(nv); brea; ase PLAC_KIK:stratoD(e);brak; se PNALTY_KICK : stegyForPK(nv); brea; case FREE_KICK: tratgyFrD(env);brek; cae GAL_CK : straegyrD(env); bk;voidsratgForD(Envirnet *env) /对默认情况dul b,by ,rx; /balls cordiaeint lt =;b = encurretBl.pos.;by envcurrntBall.s.y;rx = en-hompos.;wheesBll();/o(&e

11、nvhe3, 3,ev-ureall.pos.,env-rentBalps.y);/negtiveDefendr(&en-ome2,2,0,58);/actvDefende(&envom,);/actieDeener(env-om2,2);/ativeefeer(&env-h3,3);/atacer(nvhom4,4);eper(&e-hom0,0);swtch(WI) cae :fnd();brek; cas 2 :defend(2);bra; cs 3: defend(3); brek; cas4 : attck(); ea; cae 5: ttack(5); rk;case 6 :aack(6);break; cae 7 :tt(7); brek; cse 8: attack(8); rak; cas 9:tck(); br;/以下相当于紧急模块if(bx 882 &y33.3& by -0.5)o(&env-hme0,0, b-.3, b);fo(lt=0;t5;t+) if(caKSot(nvhomelt,l) & env-hmel.pox hoelt,lt,bx,b

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 社会学

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号