@@ -26,11 +26,7 @@ pub fn run_chokudai() {
2626 // run(client, join_resp);
2727}
2828
29- pub fn run ( client : Client , join_resp : Response , prep : Preprocess ) {
30-
31-
32- let mut router = super :: routing:: Router :: new ( ) ;
33-
29+ pub fn run ( client : Client , join_resp : Response , mut prep : Preprocess ) {
3430 let all = join_resp. info . ability . potential ;
3531 let shoot = 64 ;
3632 let mut heal = 10 ;
@@ -51,8 +47,7 @@ pub fn run(client: Client, join_resp: Response, prep: Preprocess){
5147
5248 //COMMANDS
5349 while resp. stage != 2 {
54-
55- resp = client. command ( & chokud_ai ( & resp, & id, & my_role, & mut e_data, & prep, & mut router) ) ;
50+ resp = client. command ( & chokud_ai ( & resp, & id, & my_role, & mut e_data, & mut prep) ) ;
5651 //dbg!(&resp);
5752 }
5853}
@@ -62,7 +57,7 @@ fn dist(a: &Ship, b: &Ship) -> i32{
6257 return ( a. pos . 0 - b. pos . 0 ) . abs ( ) + ( a. pos . 1 - b. pos . 1 ) . abs ( ) ;
6358}
6459
65- fn chokud_ai ( resp : & Response , id : & i32 , my_role : & i32 , e_data : & mut EnemyData , prep : & Preprocess , router : & mut super :: routing :: Router ) -> Vec < Command > {
60+ fn chokud_ai ( resp : & Response , id : & i32 , my_role : & i32 , e_data : & mut EnemyData , prep : & mut Preprocess ) -> Vec < Command > {
6661
6762 let mut myship = resp. state . ships [ 0 ] . clone ( ) ;
6863 let mut enemyship = resp. state . ships [ 0 ] . clone ( ) ;
@@ -156,7 +151,7 @@ fn chokud_ai(resp: &Response, id: &i32, my_role: &i32, e_data: &mut EnemyData, p
156151
157152 if e_data. go_near {
158153 eprintln ! ( "Go Near!" ) ;
159- let ( dvx, dvy) = router. doit ( & myship, & enemyship) ;
154+ let ( dvx, dvy) = prep . router . doit ( & myship, & enemyship) ;
160155 addx = dvx;
161156 addy = dvy;
162157 }
0 commit comments