https://www.codingame.com/ide/puzzle/mars-lander-episode-1
난이도는 easy이고, 실제로도 굉장히 간단한 문제였는데 영어 해석이 안되어서 한참 걸렸다. 영어가 문제다..
이 문제는 총 3단계로 이루어져 있는 것 같은데 easy 난이도에서는 vertical speed만 고려된다. 다른 단계에서는 아마 fuel, angle, horizental speed 등도 고려될 것 같다.
지금 단계에서의 나의 답안은 100% score를 받기는 했는데 아마 난이도가 올라갔을 때는 지금 코드에서 많은 것을 개선해야할 것 같다. 다른 best solution을 봐도 그렇다.
연료를 300이상 남기면서 통과해야지 3개의 acheivements를 달성할 수 있다.
# game loop
while True:
# h_speed: the horizontal speed (in m/s), can be negative.
# v_speed: the vertical speed (in m/s), can be negative.
# fuel: the quantity of remaining fuel in liters.
# rotate: the rotation angle in degrees (-90 to 90).
# power: the thrust power (0 to 4).
x, y, h_speed, v_speed, fuel, rotate, power = [int(i) for i in input().split()]
# Write an action using print
if abs(v_speed) > 40: #처음에 0으로 시작한 자유낙하 속도가 40을 넘어가면 power를 올려준다. power는 최대 4까지만 올릴 수 있다.
if power <4:
power = power + 1
elif abs(v_speed) < 40 and v_speed < 0 and power ==4 :
power = power - 1
elif v_speed > 0: #속도가 양수라는 뜻은 shuttle이 오히려 위로 상승한다는 이야기이기 때문에 power를 낮춰준다.
if power > 0:
power = power - 1
# 2 integers: rotate power. rotate is the desired rotation angle (should be 0 for level 1), power is the desired thrust power (0 to 4).
print(f"0 {power}")