Example #1
0
def MoveRobot():

    count = smell()

    while count > 0:
        if left_side() == "fruit":
            turn(-1)
        elif right_side() == "fruit":
            turn(1)
        move()
        count = smell()
        print(count)

    else:
        turn(2)
        move()
        MoveRobot()
Example #2
0
def MoveRobot():

  count = smell()
  
  while count > 0: 
    if left_side() == "fruit":
      turn(-1)
    elif right_side() == "fruit":
      turn(1)
    move()
    count = smell()
    print(count)
  
  else:
    turn(2)
    move()
    MoveRobot()
Example #3
0
def MoveRobot(path):
    if smell() > 0:

        if left_side() == "fruit":
            turn(3)

        elif right_side() == "fruit":
            turn(1)

        move()
        path += 1

    else:
        turn(-2)
        for i in range(0, path):
            move()
        path = 0
    MoveRobot(path)
Example #4
0
def MoveRobot(path): 
  if smell() > 0:
    
    if left_side() == "fruit":
      turn(3)
      
    elif right_side() == "fruit":
      turn(1)
    
    move()
    path += 1
    
  else: 
    turn(-2)
    for i in range(0, path):
      move()
    path = 0
  MoveRobot(path)
Example #5
0
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)

thing = touch()  #Initialise
count = smell()
path = 0

#def TurnRobot(IsFruit, path):

#if left_side() == "fruit":
#  turn(3)

# elif right_side() == "fruit":
# turn(1)

# if IsFruit == False:
# turn(-2)


def MoveRobot(path):
    if smell() > 0:

        if left_side() == "fruit":
            turn(3)

        elif right_side() == "fruit":
            turn(1)

        move()
        path += 1
Example #6
0
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)



thing = touch() #Initialise
count = smell() 
path = 0


#def TurnRobot(IsFruit, path):
  
  #if left_side() == "fruit":
  #  turn(3)

 # elif right_side() == "fruit":
   # turn(1)
  
 # if IsFruit == False: 
   # turn(-2)
    

def MoveRobot(path): 
  if smell() > 0:
    
    if left_side() == "fruit":
Example #7
0
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)
print smell()

#for i in range (0,100):
#move()

# Add your code here
Example #8
0
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)
from random import random

# This is a fairly useless algorithm!
dir = 1
while True:
  move()
  
  i=0
  while (smell() and look() != 'fruit' and i<4):
    turn(1)
    i=i+1
  
  if smell()==0 and look() != 'fruit':
    steps = int(3*random())
    turn(steps)
    for i in range(1,5):
      move()
Example #9
0
from tealight.robot import move, turn, look, touch, smell, left_side, right_side

move()
turn()
look()
touch()
smell()
left_side()
right_side()
Example #10
0
import random

from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)
n=0
while n<2000:
  n = n+1
  if look() == 'fruit':
    move()
  elif right_side() == 'fruit':
      turn(1)
      while look() == 'fruit':
        move()
  elif left_side() == 'fruit':
      turn(1)
      while look() == 'fruit':
        move()
  elif smell() >= 1: 
      i = random.randint (-1, 2)
      turn(i)
      move()
  else:
      i = random.randint (-1, 2)
      turn(i) 
      move()
Example #11
0
    move ()
    moved=moved +1

turn (1)
if touch ()== "fruit":
  go()

turn (1)
if touch () == "fruit":
  for n in range (4):
    move()

turn (1)
if touch ()== "fruit":
  for n in range (8):
   move ()

turn (-1)
while smell ()== "fruit":
    move ()

if touch ()== "wall":
  turn (1)
  if touch ()=="wall":


    

    
go ()
Example #12
0
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)
print smell()

#for i in range (0,100):
  #move()


# Add your code here