コード例 #1
0
ファイル: cleanup.py プロジェクト: Krimzar/tealight-files
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()
コード例 #2
0
ファイル: cleanup.py プロジェクト: Krimzar/tealight-files
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()
コード例 #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)
コード例 #4
0
ファイル: vine.py プロジェクト: Krimzar/tealight-files
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)
コード例 #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
コード例 #6
0
ファイル: vine.py プロジェクト: Krimzar/tealight-files
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":
コード例 #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
コード例 #8
0
ファイル: search.py プロジェクト: andresarcia/tealight-files
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()
コード例 #9
0
ファイル: refuel.py プロジェクト: jotirai/tealight-files
from tealight.robot import move, turn, look, touch, smell, left_side, right_side

move()
turn()
look()
touch()
smell()
left_side()
right_side()
コード例 #10
0
ファイル: vine.py プロジェクト: callum9977/tealight-files
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()
コード例 #11
0
ファイル: mine.py プロジェクト: chloea/tealight-files
    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 ()
コード例 #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