#Robot side, Solution
from JudgeInit import SendMovement
from JudgeInit import World
Step=''

LastMeasurement = ['','','','']

from random import randint

def RobotMove():
    global Step
    print (SendMovement(Step))# You can use RobotMove() without print, like this
    #SendMovement(Step)

def RobotSense(Measurement):
    global World
    global LastMeasurement
    global Step
    #print (World)
    LastMeasurement=Measurement
    WhereTo=[]
    for Direction in LastMeasurement:
        if LastMeasurement[Direction]=='road' or LastMeasurement[Direction]=='finish':
            WhereTo.append(Direction)
    # Now, in List 'WhereTo' we have all directions where to we can go       
    randvar=randint(0,len(WhereTo)-1)
    if randvar==0:
        Step=WhereTo[0]
    elif randvar==1:
        Step=WhereTo[1]
    elif randvar==2:
        Step=WhereTo[2]
    else:
        Step=WhereTo[3]
    pass
