CodinGame플랫폼에서 제공하는 AI 코딩실력 향상을 위한 컨텐츠이다.
import sys
import math
# This code automatically collects game data in an infinite loop.
# It uses the standard input to place data into the game variables such as x and y.
# YOU DO NOT NEED TO MODIFY THE INITIALIZATION OF THE GAME VARIABLES.
# game loop
while True:
# x: x position of your pod
# y: y position of your pod
# next_checkpoint_x: x position of the next check point
# next_checkpoint_y: y position of the next check point
x, y, next_checkpoint_x, next_checkpoint_y = [int(i) for i in input().split()]
# Write an action using print
# To debug: print("Debug messages...", file=sys.stderr, flush=True)
# Edit this line to output the target position
# and thrust (0 <= thrust <= 100)
# i.e.: "x y thrust"
print(str(next_checkpoint_x) + " " + str(next_checkpoint_y) + " 50")
화면의 좌측 밑에 주어지는 파워 입력값이 있는데, 보스는 65 기본 값은 50이었다. 나의 bot의 power를 100으로 향상시켜 보스를 이겼다.
하지만 이번 문제에서 요구하는 부분은 다음 목표지점까지의 angle 값이 진행 방향과 다르다면 power를 0으로 바꾸어 전환 속도를 올리는 것이었다.
thrust = 0
if next_checkpoint_angle > 45 or next_checkpoint_angle < -135:
thrust = 0
else :
thrust = 100
print(str(next_checkpoint_x) + " " + str(next_checkpoint_y) + " " + str(thrust))
주어진 코드를 수정하여 위처럼 문제를 해결하였다.