Skip to content

Instantly share code, notes, and snippets.

@ZengetsuFR
Created June 3, 2015 06:51
Show Gist options
  • Save ZengetsuFR/af38fa93de1e55d7a401 to your computer and use it in GitHub Desktop.
Save ZengetsuFR/af38fa93de1e55d7a401 to your computer and use it in GitHub Desktop.
Résolution du jeu "Los Angeles, 2029..." sur le site codingame.com
import sys, math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
LongueurPontAvantTrou = int(raw_input()) # the length of the road before the gap.
LongueurTrou = int(raw_input()) # the length of the gap.
LongueurPontApresTrou = int(raw_input()) # the length of the landing platform.
# game loop
while 1:
S = int(raw_input()) # the motorbike's speed.
X = int(raw_input()) # the position on the road of the motorbike.
#Dictionnaire qui contient les actions a entreprendre
options = {"JUMP":X+1==LongueurPontAvantTrou,
"WAIT":S>LongueurTrou and X+1<LongueurPontAvantTrou +1,
"SPEED":S<=LongueurTrou,
"SLOW":X+1>= LongueurPontAvantTrou+1 or S> LongueurTrou +1}
#on execute les actions qui sont = TRUE
for key,value in options.items():
if value==True:
print key
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment