📄 attention_to_~
字号:
(79) # () S 8 T (MYLOG_POL\(0,<<") S(ATTENTION 2: Checking relevant teammate ) str(") p n(80) # () S 8 T () S 16 T (<<teammate->number<<") S( age ) str("<<teammate->age\);) p n(81) # () S 8 T () S(if) K(\(new_att == 0 && teammate->age >1\){ ) p(// not yet found and too old) c n(82) # () S() p 8 T ( new_att = teammate->number;) N(83) # () S 8 T (}) N(84) # () S 8 T () S(if) K(\(teammate->age >3\){ ) p(// much too old -> emergency set attention) c n(85) # () S() p 8 T ( new_att = teammate->number;) N(86) # () S 8 T ( ) S(break) K(;) p n(87) # () S 8 T (}) N(88) # ( }) N(89) # ( ) S(else) K({ ) p(// strange: relevant teammate not found -> set attention to) c n(90) # () S() p 8 T (MYLOG_POL\(0,<<") S(ATTENTION 2: Teammate ) str("<<WSinfo::relevant_teammate[i]<<") p( not f) str n0 T (ound. Set attention) S("\);) p n(91) # () S 8 T (new_att =WSinfo::relevant_teammate[i];) N(92) # () S 8 T () S(break) K(; ) p(// quit loop) c n(93) # () S( }) p n(94) # ( }) N(95) # ( }) N(96) # () N(97) # () N(98) # () N(99) # ( ) S(int) k( old_att= WSinfo::ws->my_attentionto;) p n(100) # ( ) S(if) K( \(old_att <= 0\)) p n(101) # ( old_att= 0;) N(102) # ( ) S(if) K( \(new_att <= 0\)) p n(103) # ( new_att= 0;) N(104) # () N(105) # ( ) S(if) K( \( old_att == new_att \) {) p n(106) # ( MYLOG_POL\(0,<<") S(ATTENTION TO: old attention = new attention: ) str("<<new_att\);) p n(107) # ( ) S(return) K(;) p n(108) # ( }) N(109) # () N(110) # () N(111) # ( ) S(if) K( \( new_att > 0 \) {) p n(112) # () S(#if) K( 0 ) p(// ridi: do not check this -> we want to listen to players, that we don' t) c n0 T ( see currently) N(113) # () S( PPlayer p= WSinfo::get_teammate_by_number\(new_att\);) p n(114) # ( ) S(if) K( \( p && p->alive \){ ) p(//otherwise attentionto causes \(wrong command form\) me) c n0 T (ssages) N(115) # () S(#endif) K n(116) # () S( cmd.cmd_att.set_attentionto\(new_att\);) p n(117) # ( MYLOG_POL\(0,<<") S(ATTENTION TO: Set Attention to player ) str("<<new_att\);) p n(118) # ( ) S(// }) c n(119) # () S( }) p n(120) # ( ) S(else) K({ ) p(// new_att <= 0; this should not happen) c n(121) # () S( cmd.cmd_att.set_attentionto_none\(\);) p n(122) # ( MYLOG_POL\(0,<<") S(ATTENTION TO: set NO attention -> CHECK!!!) str("\);) p n(123) # ( }) N(124) # (}) N(attention_to_bma.c) (Page 2/5) (Jul 28, 04 13:58) titlebordergrestore(Printed by Thomas Gabel) rhead(attention_to_bma.c) (1/3) (Monday April 04, 2005) footerend % of iso1dictpagesave restoreshowpage%%Page: (3-4) 2%%BeginPageSetup/pagesave save defsh 0 translate 90 rotate%%EndPageSetupiso1dict begingsavellx lly 12 add translate/v 0 store/x0 x v get 3.167824 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(125) # () p n(126) # () S(void) k( AttentionTo::construct_say_message\(Cmd & cmd\){) p n(127) # ( IntentionType intention;) N(128) # ( Vector target;) N(129) # ( Value speed,dir;) N(130) # ( ) S(int) k( target_player_number;) p n(131) # () N(132) # ( ) S(// Communication for GOALIE) c n(133) # () S( ) p(if) K( \(ClientOptions::consider_goalie\) {) p n(134) # ( ) S(if) K( \(\(WSinfo::ball->age <= 4\) && \(WSinfo::ws->play_mode == PM_PlayOn\)\) {) p n(135) # ( cmd.cmd_say.set_ball\(WSinfo::ball->pos, WSinfo::ball->vel, WSinfo::ball->a) N0 T (ge, 4\);) N(136) # ( ) S(return) K(;) p n(137) # ( } ) N(138) # ( } ) S(// Goalie) c n(139) # () N(140) # () N(141) # () S( ) p(// Communication for PASS PLAYER) c n(142) # () S( ) p(if) K(\(Blackboard::get_pass_info\(WSinfo::ws->time, speed, target, target_player_nu) p n0 T (mber\) == true\){) N(143) # ( MYLOG_POL\(0, << ") S(COMMUNICATION: Blackboard intention is PASS: to ) str("<<target_player_numb) p n0 T (er<<") S( target pos ) str(") p n(144) # () S 8 T ( <<target<<") S( w. speed ) str("<<speed<<") p( -> Communicate) str("\);) p n(145) # ( ) S(int) k( cycles2go = 0; ) p(// communicate for one cycle only) c n(146) # () S( Vector ballvel;) p n(147) # ( ballvel.init_polar\(speed,\(target - WSinfo::me->pos\).arg\(\)\);) N(148) # ( cmd.cmd_say.set_pass\(WSinfo::me->pos,ballvel,WSinfo::ws->time + cycles2go\);) N(149) # ( ) S(return) K(;) p n(150) # ( } ) S(// pass info was set) c n(151) # () N(152) # () S( ) p(// Communication for PASS PLAYER, WHEN BALL JUST LEFT) c n(153) # () S( ) p(if) K(\(WSinfo::is_ball_kickable\(\) == false && WSmemory::ball_was_kickable4me_at ==) p n0 T ( WSinfo::ws->time -1\){) N(154) # ( ) S(// I had the ball last time, so communicate where the ball is now) c n(155) # () S( MYLOG_POL\(0, << ") p(Communicate: I had the ball last cycle, now I say where it goes ) str("\);) p n(156) # ( cmd.cmd_say.set_ball\(WSinfo::ball->pos, WSinfo::ball->vel, WSinfo::ball->age) N0 T (, WSinfo::ball->age \);) N(157) # ( }) N(158) # ( ) N(159) # ( ) S(// Communication for BALL HOLDER) c n(160) # () S( ) p(if) K(\(WSinfo::is_ball_pos_valid\(\) && WSinfo::is_ball_kickable\(\)\){ ) p(// ball is kick) c n0 T (able, but no pass info was set) N(161) # () S( MYLOG_POL\(0, << ") p(COMMUNICATE: I have the ball and my Position. Use set me as Ballholder) str("\);) p n(162) # ( cmd.cmd_say.set_me_as_ball_holder\(WSinfo::me->pos\);) N(163) # ( ) S(return) K(;) p n(164) # ( }) N(165) # () N(166) # ( ) S(// Communication for PLAYER WO BALL) c n(167) # () S( generate_players4communication\(cmd\);) p n(168) # (}) N(169) # () N(170) # () S(#define) K( MAX_SAY_CAPACITY 4 ) p(// no more than 4 players) c n(171) # () N(172) # () S(void) k( AttentionTo::generate_players4communication\(Cmd & cmd_form\){) p n(173) # () N(174) # ( WSpset players4communication;) N(175) # ( PPlayer ballholder = WSinfo::teammate_closest2ball\(\);) N(176) # () N(177) # ( ) S(if) K(\(!WSinfo::is_ball_kickable\(\)\) {) p(// I do not control the ball myself) c n(178) # () S( ) p(// compute my next position) c n(179) # () S( Vector my_next_pos, my_next_vel;) p n(180) # ( Angle my_next_ang;) N(181) # ( Tools::model_player_movement\(WSinfo::me->pos,WSinfo::me->vel,WSinfo::me->ang) N0 T (.get_value\(\),) N(182) # () S 8 T () S 16 T () S 24 T () S 32 T ( cmd_form.cmd_main, my_next_pos, ) N(183) # () S 8 T () S 16 T () S 24 T () S 32 T ( my_next_vel, my_next_ang\);) N(attention_to_bma.c) (Page 3/5) (Jul 28, 04 13:58) titleborder/v 1 store/x0 x v get 3.167824 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(184) # () p n(185) # ( MYLOG_POL\(0,<<") S(I am not holding the ball, so communicate my next position ) str(") p n(186) # () S 8 T ( << my_next_pos<<") S( \(current pos ) str("<<WSinfo::me->pos\); ) p n(187) # ( ) S(// MYLOG_POL\(0,<<_2D<<C2D\(my_next_pos.x, my_next_pos.y, 1.1, "grey"\)\);) c n(188) # () N(189) # () S( ) p(// construct communication set :) c n(190) # () S( WS::Player next_me = *WSinfo::me;) p n(191) # () N(192) # ( next_me.pos = my_next_pos;) N(193) # ( players4communication.append\(&next_me\);) N(194) # ( ) N(195) # ( ) S(if) K(\(ballholder !=) p(NULL) K(\){) p n(196) # ( WSpset pset= WSinfo::valid_opponents;) N(197) # ( pset.keep_players_with_max_age\(1\);) N(198) # () N(199) # ( ) S(float) k( width1 = 1.0 * 2* \(\(ballholder->pos-WSinfo::me->pos\).norm\(\)/2.5\);) p n(200) # ( ) S(float) k( width2 = 4; ) p(// at ball be a little smaller) c n(201) # () S( Quadrangle2d check_area = Quadrangle2d\(ballholder->pos, WSinfo::me->pos , ) p n0 T (width1, width2\);) N(202) # ( LOG_POL\(0, <<_2D<<check_area \);) N(203) # ( pset.keep_players_in\(check_area\);) N(204) # ( ) S(//pset.keep_players_in_quadrangle\(WSinfo::me->pos, ballholder->pos, 10 \); ) c n0 T (// players between me and ballholder) N(205) # () N(206) # () S( pset.keep_and_sort_closest_players_to_point\(2,ballholder->pos\);) p n(207) # ( ) N(208) # ( ) S(if) K(\(pset.num>0\){) p n(209) # () S 8 T (MYLOG_POL\(0,<<") S(COMMUNICATE: Found Opponents in passway: ) str("<<pset.num\);) p n(210) # () S 8 T (players4communication.append\(pset\);) N(211) # ( }) N(212) # ( pset= WSinfo::valid_opponents;) N(213) # ( pset.keep_players_with_max_age\(0\);) N(214) # ( pset.keep_players_in_circle\(ballholder->pos,5.\); ) S(// opponents close 2 me) c n(215) # () S( pset.keep_and_sort_closest_players_to_point\(2,ballholder->pos\);) p n(216) # ( ) S(if) K(\(pset.num>0\){) p n(217) # () S 8 T (MYLOG_POL\(0,<<") S(COMMUNICATE: Found Opponents close2e ballholder: ) str("<<pset.num\);) p n(218) # () S 8 T (players4communication.join\(pset\);) N(219) # ( }) N(220) # ( }) N(221) # () N(222) # ( ) S(if) K(\(players4communication.num < MAX_SAY_CAPACITY\){) p n(223) # ( WSpset pset= WSinfo::valid_opponents;) N(224) # ( pset.keep_players_with_max_age\(0\);) N(225) # ( pset.keep_players_in_circle\(my_next_pos,40.\); ) S(// opponents close 2 me) c n(226) # () S( pset.keep_and_sort_closest_players_to_point\(10,my_next_pos\);) p n(227) # ( ) S(if) K(\(pset.num>0\){) p n(228) # () S 8 T (MYLOG_POL\(0,<<") S(COMMUNICATE: Found Opponents close2e my next pos: ) str("<<pset.num\);) p n(229) # () S 8 T (players4communication.join\(pset\);) N(230) # ( }) N(231) # ( }) N(232) # () N(233) # ( ) S(if) K(\(players4communication.num < MAX_SAY_CAPACITY\){) p n(234) # ( WSpset pset= WSinfo::valid_teammates_without_me;) N(235) # ( pset.keep_players_with_max_age\(0\);) N(236) # ( pset.keep_players_in_circle\(my_next_pos,40.\); ) S(// opponents close 2 me) c n(237) # () S( pset.keep_and_sort_closest_players_to_point\(10,my_next_pos\);) p n(238) # ( ) S(if) K(\(pset.num>0\){) p n(239) # () S 8 T (MYLOG_POL\(0,<<") S(COMMUNICATE: Found Opponents close2e my next pos: ) str("<<pset.num\);) p n(240) # () S 8 T (players4communication.join\(pset\);) N(241) # ( }) N(242) # ( }) N(243) # () N(244) # () N(245) # () N(246) # ( } ) S(// ball is not kickable for me and teammate controls the ball) c n(247) # () N(attention_to_bma.c) (Page 4/5) (Jul 28, 04 13:58) titlebordergrestore(Printed by Thomas Gabel) rhead(attention_to_bma.c) (2/3) (Monday April 04, 2005) footerend % of iso1dictpagesave restoreshowpage%%Page: (5) 3%%BeginPageSetup/pagesave save defsh 0 translate 90 rotate%%EndPageSetupiso1dict begingsavellx lly 12 add translate/v 0 store/x0 x v get 3.167824 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(248) # () p n(249) # () N(250) # ( ) S(for) K(\() p(int) k( i=0; i<players4communication.num;i++\){) p n(251) # ( MYLOG_POL\(0,<<") S(My communication set ) str("<<i<<") p( number ) str(") p n(252) # () S 8 T ( <<players4communication[i]->number<<") S( pos ) str("<<players4communication[i]) p n0 T (->pos\);) N(253) # ( ) N(254) # ( MYLOG_POL\(0,<<_2D<<C2D\(players4communication[i]->pos.x, players4communicatio) N0 T (n[i]->pos.y, 1.3, ") S(magenta) str("\)\);) p n(255) # ( }) N(256) # ( cmd_form.cmd_say.set_players\( players4communication \);) N(257) # () N(258) # (}) N(259) # () N(260) # (bool AttentionTo::teammate_controls_ball\() S(int) k( &number, Vector & pos\){) p n(261) # ( number = 0; ) S(// default) c n(262) # () S( ) p(if) K(\(WSinfo::is_ball_kickable\(\) != false\){) p(// I control the ball myself!) c n(263) # () S( ) p(return) K( false;) p n(264) # ( }) N(265) # ( ) S(int) k( steps2go;) p n(266) # ( Vector ipos;) N(267) # ( ) N(268) # ( PPlayer teammate=Tools::get_our_fastest_player2ball\(ipos, steps2go\);) N(269) # ( ) S(if) K(\(steps2go <=2 && teammate\){ ) p(// check: steps2go <= 1 oder steps2go <= 2 besse) c n0 T (r?) N(270) # () S( number=teammate->number;) p n(271) # ( pos = teammate->pos;) N(272) # ( ) S(return) K( true;) p n(273) # ( }) N(274) # ( ) S(return) K( false;) p n(275) # (}) N(276) # () N(attention_to_bma.c) (Page 5/5) (Jul 28, 04 13:58) titlebordergrestore(Printed by Thomas Gabel) rhead(attention_to_bma.c) (3/3) (Monday April 04, 2005) footerend % of iso1dictpagesave restoreshowpage%%Trailerend%%EOF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -