(* Auto-generated code below aims at helping you parse *) (* the standard input according to the problem statement. *) let open Printf in let debug = fprintf stderr in let first_turn = ref true in let old_x = ref 0 in let old_y = ref 0 in (* game loop *) while true do (* nextcheckpointx: x position of the next check point *) (* nextcheckpointy: y position of the next check point *) (* nextcheckpointdist: distance to the next checkpoint *) (* nextcheckpointangle: angle between your pod orientation and the direction of the next checkpoint *) let line = input_line stdin in let x, y, nextcheckpointx, nextcheckpointy, nextcheckpointdist, nextcheckpointangle = Scanf.sscanf line "%d %d %d %d %d %d" (fun x y nextcheckpointx nextcheckpointy nextcheckpointdist nextcheckpointangle -> (x, y, nextcheckpointx, nextcheckpointy, nextcheckpointdist, nextcheckpointangle)) in if !first_turn then begin old_x := x ; old_y := y ; first_turn := false end ; let d_x = x - !old_x in let d_y = y - !old_y in let future_x = x + 2 * d_x in let future_y = x + 2 * d_y in let line = input_line stdin in let opponentx, opponenty = Scanf.sscanf line "%d %d" (fun opponentx opponenty -> (opponentx, opponenty)) in (* Write an action using print_endline *) (* To debug: prerr_endline "Debug message"; *) let ckpt_ray = 600 in (* You have to output the target position *) (* followed by the power (0 <= thrust <= 100) *) (* i.e.: "x y thrust" *) let is_here = nextcheckpointdist < ckpt_ray in let is_near = nextcheckpointdist < ckpt_ray * 4 in let is_far = nextcheckpointdist >= ckpt_ray * 6 in let is_aligned = nextcheckpointangle > -5 && nextcheckpointangle < 5 in let is_near_aligned = nextcheckpointangle > -15 && nextcheckpointangle < 15 in let is_wide_aligned = nextcheckpointangle > -30 && nextcheckpointangle < 30 in let is_aside = nextcheckpointangle > -60 || nextcheckpointangle < 60 in let is_behind = nextcheckpointangle >= 90 || nextcheckpointangle <= -90 in let use_boost = is_aligned && is_far in let target_x = (future_x + nextcheckpointx) / 2 in let target_y = (future_y + nextcheckpointy) / 2 in debug "angle = %d\n%!" nextcheckpointangle ; let thrust = (* if is_aligned && is_far then 100 else if is_aligned && is_near then 80 else if is_near_aligned && is_far then 80 else if is_near_aligned && is_near then 70 else if is_wide_aligned && is_far then 60 else if is_wide_aligned && is_near then 50 else if is_aside then 40 else *) if is_aside then 20 else if is_behind then 2 else 100 in let power_str = match use_boost with | false -> string_of_int thrust | true -> "BOOST" in printf "%d %d %s\n%!" target_x target_y power_str ; (); done;