Mad Pod Racing

윤동환·2022년 12월 4일
0

Mad Pod Racing

CodinGame플랫폼에서 제공하는 AI 코딩실력 향상을 위한 컨텐츠이다.

모든 검문소를 가장 빠르게 통화하는 bot을 만드는것이 목표이다.

주어지는 코드

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")

주어진 코드의 x, y좌표가 잘못 적혀있어 수정이 조금 필요하지만, 수정하고 나면 아래와 같이 다음 레벨을 추천해준다.

이처럼 좀더 빠른 적을 제공하여 나의 코드를 좀더 빠르게 움직이도록 수정을 요구한다.

화면의 좌측 밑에 주어지는 파워 입력값이 있는데, 보스는 65 기본 값은 50이었다. 나의 bot의 power를 100으로 향상시켜 보스를 이겼다.

wood 3 리그에 들어갈수 있게 되었다.

전체 리그 LEVELS

wood가 열리면서 distance, angle, opponet를 변수로 받아 수정할 수 있게 되었다.

하지만 이번 문제에서 요구하는 부분은 다음 목표지점까지의 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))

주어진 코드를 수정하여 위처럼 문제를 해결하였다.

여기까지하니 10000명중 3500등이라고 한다!

profile
모르면 공부하고 알게되면 공유하는 개발자

0개의 댓글

관련 채용 정보