コード例 #1
0
ファイル: search.py プロジェクト: asmith30/tealight-files
def scan():
  i = 0
  while look()=='wall' and i<4:
    turn(1)
    i=i+1
  if look()=='wall':
    return 0
  else:
    return 1
コード例 #2
0
ファイル: refuel.py プロジェクト: c-ryan747/tealight-files
def find_fruit():
  for i in range(1,4):
    if (look() == "fruit"):
      move()
      return True
    else:
      turn(1)
  return False
コード例 #3
0
ファイル: palace.py プロジェクト: asmith30/tealight-files
def find():
  i=0
  while touch()!='fruit' and left_side()!='fruit' and right_side()!='fruit':
   if look()=='fruit':
      i=i+1
      print i
      move()
      
   else:
      turn(-1)
  move()
コード例 #4
0
ファイル: palace.py プロジェクト: asmith30/tealight-files
def trythisway():
  move()
  if left_side()=='fruit':
    return -1
  elif right_side()=='fruit':
    return 1
  elif str(look())=='fruit':
    move()
    return(2)
  else:
     turn(2)
     move()
     return(0)
コード例 #5
0
def Movement():

 FruitPresence = touch()
  
 while (FruitPresence == 'fruit'):
  move()
  FruitPresence = touch()
  NewSource = look()
 if NewSource == 'fruit':
  Movement()  
 if FruitPresence != 'fruit':
  turn(-1)
  Movement()
コード例 #6
0
ファイル: trail.py プロジェクト: Minghsien/tealight-files
def search():
  while True:
    if touch() =="fruit":
      move()
    elif right_side() == "fruit":
      turn(1)
      move()
    elif left_side() == "fruit":
      turn(-1)
      move()
    elif look() == "fruit":
      move()
    else:
      turn(1)
コード例 #7
0
ファイル: palace.py プロジェクト: asmith30/tealight-files
def traverse():
  d = trythisway()
  if d<>0:
    turn(d)
    move()
    turn(d*-1)
  else:
    e = trythatway()
    if e<>0:
      turn(e)
      move()
      '''
      turn(e*-1)
      '''
    else:
      if str(look())=='fruit':
        move()
コード例 #8
0
ファイル: chess.py プロジェクト: Krimzar/tealight-files
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)



thing = look() #Initialise
count = smell()

while count > 0: 
  if touch() == "fruit" and (right_side() != "fruit" and left_side() != "fruit"):
    move() 
  elif left_side() == "fruit":
    turn(3)
  elif right_side() == "fruit":
    turn(1)
  move()

  thing = look()
  count = smell()
  



#thing = look()
#print(thing)
コード例 #9
0
ファイル: refuel.py プロジェクト: sagelin/tealight-files
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                       right_side)

turncounter = 0
while True:
  print "breaking"
  if look() =='wall':
    print "wall"
    turn(1)
    turncounter += 1
  if turncounter == 4:
    turncounter = 0
    while touch() == 'wall':
      turn(1)
    move()
  if look() =='fruit':
    turncounter = 0
  while look() =="fruit":
    move()
    break
コード例 #10
0
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)
while True:
    for n in range(-1, 2, 2):
        print n
        while look() == 'fruit' or left_side() == 'fruit' or right_side(
        ) == 'fruit':
            move()
        turn(n)
        move()
        turn(n)
コード例 #11
0
def super_move():
    if touch() != "wall":
        move()


while True:
    if touch() == "fruit":
        x = 0
        super_move()
    elif right_side() == "fruit":
        x = 0
        turn(1)
        super_move()
    elif left_side() == "fruit":
        x = 0
        turn(3)
        super_move()
    elif look() == "fruit":
        x = 0
        super_move()
    elif x < 3:
        x = x + 1
        turn(1)
    elif touch() == "wall":
        turn(1)
    else:
        x = 0
        super_move()
        turn(1)
        super_move()
コード例 #12
0
                            left_side, 
                            right_side)

wallcount = 0

def MoveSearch(thing):
  global wallcount
  wallcount = 0
  distance = 1
  i = 0
  while i < distance:
    if touch() == thing:
      distance += 1
    i += 1
    if i < distance:
      move()

z = 0
while z < 512:
  z+=1
  if touch() == 'fruit':
    MoveSearch('fruit')
  elif left_side() == 'fruit':
    turn(-1)
  elif right_side() == 'fruit':
    turn(1)
  elif look() == 'wall' and wallcount < 4:
    turn(1)
    wallcount += 1
  elif look() == 'fruit':
    MoveSearch(None)
コード例 #13
0
ファイル: field.py プロジェクト: TheAIAJ/tealight-files
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)

# Add your code here
i = 400
for i in range(400):
  if look() == "flower":
    move()
  
コード例 #14
0
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)

while True:
    if look() == 'fruit':
        move()
    elif right_side() == 'fruit':
        turn(1)
        while look() == 'fruit':
            move()
    elif left_side() == 'fruit':
        turn(1)
        while look() == 'fruit':
            move()
    else:
        turn(1)
        move()
コード例 #15
0
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)

thing = look()  #Initialise
count = smell()

while count > 0:
    if touch() == "fruit" and (right_side() != "fruit"
                               and left_side() != "fruit"):
        move()
    elif left_side() == "fruit":
        turn(3)
    elif right_side() == "fruit":
        turn(1)
    move()

    thing = look()
    count = smell()

#thing = look()
#print(thing)
コード例 #16
0
ファイル: refuel.py プロジェクト: GriffithsBen/tealight-files
                            smell, 
                            left_side, 
                            right_side)

# Add your code here
while True:
  move()
 # if(left_side() == "fruit"):
 #   turn(-1)
 # elif(right_side() == "fruit"):
 #   turn(1)
 # elif (look() == "fruit"):
 #   while (look() == "fruit"):
 #     move()
  for i in range(0,4):
    while(look() == "fruit"):
      move()
    turn(1)
  #if(left_side() == None):
  #  turn(-1)
  #  move()
   
  if(touch() == "wall"):
    if(left_side() != "wall"):
      turn(-1)
      move()
    elif(right_side() != "wall"):
      turn(1) 
      move()
    else:
      turn(2)
コード例 #17
0
ファイル: mine.py プロジェクト: asmith30/tealight-files
   uturn()
   flip=(flip + 1)%2
   a=str(touch())
 if a=='fruit':
   lasta='fruit'
 elif l=='fruit':
   if r=='fruit':
     turn(flip*2-1)
     flip=(flip + 1)%2
   else:
     turn(-1)
 elif r=='fruit':
   turn(1)
 else:
   turn(1)
   if str(look())=='fruit':
     move()
   else:
     turn(2)
     if str(look())=='fruit':
       move()
     else:
       turn(1)
       for i in range(0,5):
         move()
 move()
 
 def uturn():
   print 'u-turn'
   print flip
   if l=='fruit':
コード例 #18
0
ファイル: refuel.py プロジェクト: louisehoa/tealight-files
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)

# Add your code here
while touch() != 'wall':
  look()
  left_side()
  move(1)
  if touch() == 'wall':
    turn(-1)
    if touch () == 'wall':
      turn(-2)
    if touch () == 'wall':
      turn(1)
コード例 #19
0
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)

# Add your code here
while True:
  for n in range(-1,2,2):
    print n
    while look() == 'fruit' or left_side() == 'fruit' or right_side == 'fruit':
      move()
    turn(n)
    move()
    turn(n)
コード例 #20
0
ファイル: trail.py プロジェクト: andresarcia/tealight-files
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)

# Add your code here
print look()
コード例 #21
0
ファイル: cleanup.py プロジェクト: Orthoc/tealight-files
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)

# Add your code here

move()
move()
move()

n = 1
while n < 2000:
    n = n + 1

    print left_side()
    if touch() == 'fruit':
        move()
    elif right_side() == 'fruit':
        turn(1)
        move()
    elif left_side() == 'fruit':

        turn(-1)
        move()
    elif look() == 'fruit':
        move()
        print right_side()
    else:
        turn(1)
        move()
        move()
コード例 #22
0
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)

turncounter = 0
while True:
    print "breaking"
    if look() == 'wall':
        print "wall"
        turn(1)
        turncounter += 1
    if turncounter == 4:
        turncounter = 0
        while touch() == 'wall':
            turn(1)
        move()
    if look() == 'fruit':
        turncounter = 0
    while look() == "fruit":
        move()
        break
コード例 #23
0
def super_move():
    if touch() != "wall":
        move()


while True:
    if touch() == "fruit":
        x = 0
        super_move()
    elif right_side() == "fruit":
        x = 0
        turn(1)
        super_move()
    elif left_side() == "fruit":
        x = 0
        turn(3)
        super_move()
    elif look() == "fruit":
        x = 0
        super_move()
    elif x < 3:
        x = x + 1
        turn(1)
    elif touch() == "wall":
        turn(1)
    else:
        x = 0
        super_move()
        turn(1)
        super_move()
コード例 #24
0
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)

# Add your code here
i = 400
for i in range(400):
    if look() == "flower":
        move()
コード例 #25
0
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)
for i in range (0,700):
  if look()=='fruit':
    while touch()!= 'fruit':
      move()
    move()
  else:
    turn(1)
# Add your code here
コード例 #26
0
ファイル: trail.py プロジェクト: andresarcia/tealight-files
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)

# Add your code here
print look()
コード例 #27
0
ファイル: cleanup.py プロジェクト: harveyives/tealight-files
def fruit():
  while look() == 'fruit':
    _move(1)
  _turn()
  fruit()
コード例 #28
0
ファイル: field.py プロジェクト: NayfS/tealight-files
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)

while True:
  i=0
  if look()=='fruit':
    move()
  elif right_side()=='fruit':
    turn(1)
    while look()=='fruit':
      move()
  elif left_side()=='fruit':
    turn(2)
    while look()=='fruit':
      move()
  else:
    while i==0:
      turn(1)
      move()
      if look()=='fruit':
        i=1
    
    
    
コード例 #29
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()
コード例 #30
0
ファイル: maze.py プロジェクト: GriffithsBen/tealight-files
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)

# Add your code here
while True:
  move()
  if(left_side() == "fruit"):
    turn(-1)
  elif(right_side() == "fruit"):
    turn(1)
  elif (look() == "fruit"):
    while (look() == "fruit"):
      move()
  if(left_side() == None):
    turn(-1)
    move()
   
  if(touch() == "wall"):
    if(left_side() != "wall"):
      turn(-1)
      move()
    elif(right_side() != "wall"):
      turn(1)      
    else:
      turn(2)
  
コード例 #31
0
ファイル: chess.py プロジェクト: sagelin/tealight-files
from tealight.robot import move, turn, look, touch, smell, left_side, right_side

# Add your code here


turncounter = 0

while True:

    print "breaking"
    if look() == "wall":
        print "wall"
        turn(1)
        turncounter += 1
    if turncounter == 4:
        turncounter = 0
        while touch() == "wall":
            turn(1)
        move()
    if look() == "fruit":
        turncounter = 0
    while look() == "fruit":
        move()
        break