File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Multiplayer/Bot programming/Coders strike back Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ let isStart = true
2+
3+ // game loop
4+ while ( true ) {
5+ let inputs = readline ( ) . split ( ' ' ) ;
6+ const x = parseInt ( inputs [ 0 ] ) ;
7+ const y = parseInt ( inputs [ 1 ] ) ;
8+ const nextCheckpointX = parseInt ( inputs [ 2 ] ) ; // x position of the next check point
9+ const nextCheckpointY = parseInt ( inputs [ 3 ] ) ; // y position of the next check point
10+ const nextCheckpointDist = parseInt ( inputs [ 4 ] ) ; // distance to the next checkpoint
11+ const nextCheckpointAngle = parseInt ( inputs [ 5 ] ) ; // angle between your pod orientation and the direction of the next checkpoint
12+ let input = readline ( ) . split ( ' ' ) ;
13+ const opponentX = parseInt ( input [ 0 ] ) ;
14+ const opponentY = parseInt ( input [ 1 ] ) ;
15+
16+ let thrust = 100
17+ if ( isStart ) {
18+ thrust = "BOOST"
19+ }
20+
21+ if ( nextCheckpointAngle > 90 || nextCheckpointAngle < - 90 ) {
22+ thrust = 0
23+ }
24+
25+ // You have to output the target position
26+ // followed by the power (0 <= thrust <= 100)
27+ // i.e.: "x y thrust"
28+ print ( nextCheckpointX + ' ' + nextCheckpointY + ' ' + thrust + ' ' + thrust ) ;
29+ isStart = false
30+ }
You can’t perform that action at this time.
0 commit comments