コード例 #1
0
ファイル: vine.py プロジェクト: ddimoline/tealight-files
def go():
  moved = 0
  while touch() == "fruit":
    move()
    moved = moved + 1
  
  turn(-1)
コード例 #2
0
ファイル: vine.py プロジェクト: andresarcia/tealight-files
def go():
  move()
  if (touch()!='fruit'):
    turn(-1)
    go()
    return
  go()
コード例 #3
0
def go():
  while True:
    if left_side() == False:
      turn(1)
    if right_side() == False:
      turn(-1)
    move()
コード例 #4
0
ファイル: vine.py プロジェクト: andresarcia/tealight-files
def go():
    move()
    if (touch() != 'fruit'):
        turn(-1)
        go()
        return
    go()
コード例 #5
0
def super_move():
    if touch() != "wall":
        move()
    elif left_side() == "wall":
        turn(1)
    else:
        turn(3)
コード例 #6
0
ファイル: mine.py プロジェクト: jordanc44/tealight-files
def go():
    while touch() == "fruit":
        move()

    if touch() != "fruit":
        turn(3)
        go()
コード例 #7
0
ファイル: chess.py プロジェクト: tsalam98/tealight-files
def columnsd():
  turn(-1)
  for n in range(0,4):
    move()
  turn(-1)
  for k in range(0,30):
    move()
コード例 #8
0
ファイル: chess.py プロジェクト: tsalam98/tealight-files
def rowsr():
  turn(1)
  for n in range(0,4):
    move()
  turn(1)
  for j in range(0,32):
    move()
コード例 #9
0
ファイル: chess.py プロジェクト: tsalam98/tealight-files
def rowsl():
  turn(-1)
  for n in range(0,4):
    move()
  turn(-1)
  for j in range(0,32):
    move()
コード例 #10
0
def super_move():
  if touch() != "wall":
    move()
  elif left_side() == "wall":
    turn(1)
  else:
    turn(3)
コード例 #11
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
コード例 #12
0
ファイル: maze.py プロジェクト: BasRegi/tealight-files
def main():
  while True:
   while True:
    move()
    if right_side()=='wall' and touch()=='wall':
      turn(-1)
    elif left_side()=='wall' and touch()=='wall':
      turn(1)
コード例 #13
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
コード例 #14
0
ファイル: vine.py プロジェクト: rexapex/tealight-files
def branch(dir):
    turn(dir)

    if touch() == 'fruit':
        while touch() == 'fruit':
            move()
    elif left_side() == 'fruit':
        branch(-1)
    elif right_side() == 'fruit':
        branch(1)
コード例 #15
0
ファイル: vine.py プロジェクト: rexapex/tealight-files
def branch(dir):
  turn(dir)
  
  if touch() == 'fruit':
    while touch() == 'fruit':
      move()
  elif left_side() == 'fruit':
    branch(-1)
  elif right_side() == 'fruit':
    branch(1)
コード例 #16
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()
コード例 #17
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)
コード例 #18
0
def Movement():

 FruitPresence = touch()
  
 while (FruitPresence == 'fruit'):
  move()
  FruitPresence = touch()
  NewSource = look()
 if NewSource == 'fruit':
  Movement()  
 if FruitPresence != 'fruit':
  turn(-1)
  Movement()
コード例 #19
0
ファイル: chess.py プロジェクト: clairebuckler/tealight-files
def go():
  moved = 0
  if touch() == 'fruit':
    move()
    moved = moved + 1
  elif touch() == None:
    turn(1)
  else:
    turn(1)
    go()
    
  for i in range(0,moved):
    go()
コード例 #20
0
ファイル: cleanup.py プロジェクト: jordanc44/tealight-files
def go():
    while touch() == "fruit":
        move()

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

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

    if left_side() != "fruit" and right_side != "fruit":
        move()
        go()
コード例 #21
0
ファイル: vine.py プロジェクト: zbychuk/tealight-files
def go():
    steps = 0
    while touch() == "fruit":
        move()
        steps += 1
    if left_side() == "fruit":
        turn(-1)
        go()
        turn(-1)
    if right_side() == "fruit":
        turn(1)
        go()
        turn(1)
    turn(2)
    for i in range(steps):
        move()
コード例 #22
0
ファイル: chess.py プロジェクト: Minghsien/tealight-files
def backwardssquiggle():
  for i in range(4):
    edge()
    turn(-1)
    smalledge()
    turn(-1)
    edge()
    turn(1)
    smalledge()
    turn(1)
コード例 #23
0
ファイル: chess.py プロジェクト: Minghsien/tealight-files
def squiggle():
  for i in range(4):
    edge()
    turn(1)
    smalledge()
    turn(1)
    edge()
    turn(-1)
    smalledge()
    turn(-1)
コード例 #24
0
ファイル: chess.py プロジェクト: Minghsien/tealight-files
def backwardssquiggle():
    for i in range(4):
        edge()
        turn(-1)
        smalledge()
        turn(-1)
        edge()
        turn(1)
        smalledge()
        turn(1)
コード例 #25
0
ファイル: chess.py プロジェクト: Minghsien/tealight-files
def squiggle():
    for i in range(4):
        edge()
        turn(1)
        smalledge()
        turn(1)
        edge()
        turn(-1)
        smalledge()
        turn(-1)
コード例 #26
0
ファイル: chess.py プロジェクト: MrHarcombe/tealight-files
def u_turn(right):
  if right == True:
    turn(1)
  else:
    turn(-1)
  
  for i in range(4):
    move()
  
  if right:
    turn(1)
  else:
    turn(-1)
コード例 #27
0
ファイル: refuel.py プロジェクト: c-ryan747/tealight-files
def left_way():
  while True:
    move()
    if (left_side() != "wall"):
      turn(-1)
    elif (touch() == "wall" and right_side() != "wall"):
      turn(1)
    elif (touch() == "wall"):
      turn(2)
コード例 #28
0
ファイル: vine.py プロジェクト: jotirai/tealight-files
def  go():
  moved=0
  while touch() == "fruit":
    move()
    moved = moved+1
    
    turn (-1)
    if touch() == "fruit":
      go()
      turn(2)
      if touch() == "fruit":
        go()
        
      turn(1)
      for i in range (0,moved):
        move()
        turn (2)
コード例 #29
0
def tree():
    count = 0
    while touch() == "fruit":
        move()
        count += 1

    turn(-1)
    if touch() == "fruit":
        tree()

    turn(2)
    if touch() == "fruit":
        tree()

    turn(1)
    for i in range(count):
        move()

    turn(2)
コード例 #30
0
ファイル: refuel.py プロジェクト: c-ryan747/tealight-files
def test_way():
  while True:
    if (find_fruit() == False):
      if (touch() != "wall"):
        a=1
      elif (left_side() != "wall"):
        turn(-1)
      elif (right_side() != "wall"):
        turn(1)
      elif (touch() == "wall"):
        turn(2)
      move()
コード例 #31
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)
コード例 #32
0
def walk():
  for i in range (0, 1250):
    if left_side() == None:
            turn(-1)
            move()
    if touch()=='wall':
       if left_side()=='wall':
         turn(1)
         move()
       else:
          turn(-1)
          move()
    
    else:
      move()
コード例 #33
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()
コード例 #34
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()
コード例 #35
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()
コード例 #36
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)
コード例 #37
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)
コード例 #38
0
ファイル: trail.py プロジェクト: willg-c/tealight-files
def lookAndMove():
    if touch() == 'fruit':
      return 'yes'
    if right_side() == 'fruit':
      turn(1)
      move()
      return 'yes'

    if left_side() == 'fruit':
      turn(-1)
      move()
      return 'yes'
    
    t = 0
    while t<4:
     turn(1)
     if touch() == 'fruit':
       return 'yes'
     t = t+1
    move()
    start()
コード例 #39
0
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)

# This is a fairly useless algorithm!

while True:
  move()
  
  if touch() == "wall":
    turn(2)
  
  if 
    
コード例 #40
0
ファイル: chess.py プロジェクト: alexinder/tealight-files
def turnrightand4():
    turn(1)
    distance = 4
    for n in range(0, distance):
        move()
コード例 #41
0
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)

direction = -1

turn(1)
for i in range(0, 4):
    while touch() == "fruit":
        move()
    turn(-1)

for i in range(0, 7):
    for i in range(0, 4):
        move()
    turn(direction)
    direction = -direction
    for i in range(0, 30):
        move()
    turn(direction)

for i in range(0, 2):
    for i in range(0, 3):
        move()
    turn(direction)

direction = -direction

for i in range(0, 7):
    for i in range(0, 31):
        move()
    turn(direction)
コード例 #42
0
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)

for i in range(0, 18):
    move()
turn(1)
for i in range(0, 13):
    move()
turn(1)
for i in range(0, 8):
    move()
turn(1)
for i in range(0, 7):
    move()
turn(1)
for i in range(0, 3):
    move()
turn(2)
for i in range(0, 7):
    move()
turn(1)
コード例 #43
0
ファイル: maze.py プロジェクト: Fleetabix/tealight-files
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)
collision_1 = False
collision_2 = False
tryright = False
tryleft = False
while True:
    move()
    if left_side() != "wall" and right_side() == "wall":
        turn(-1)
    elif right_side() != "wall" and left_side() == "wall":
        turn(1)
    elif right_side() != "wall" and left_side() != "wall":
        if tryright == False:
            turn(1)
            tryright = True
        elif tryleft == False:
            turn(-1)
            tryleft = True
        else:
            turn(2)
            tryright = False
            tryleft = False

    if touch() == "wall" and collision_1 == False:
        turn(1)
        collision_1 = True
    elif touch() == "wall" and collision_1 == True:
        turn(2)
        collision_1 = False
        collision_2 = True
コード例 #44
0
ファイル: chess.py プロジェクト: alexinder/tealight-files
def turnleftand4():
    turn(-1)
    distance = 4
    for n in range(0, distance):
        move()
コード例 #45
0
from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)

# This is a fairly useless algorithm!
dir=1
while True:
  move()
  
  if touch() == "wall":
    turn(2)
  if touch
  
  turn(dir)
  move()
  dir=-dir
コード例 #46
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()
コード例 #47
0
ファイル: chess.py プロジェクト: Minghsien/tealight-files
def squiggle():
    for i in range(4):
        edge()
        turn(1)
        smalledge()
        turn(1)
        edge()
        turn(-1)
        smalledge()
        turn(-1)


def backwardssquiggle():
    for i in range(4):
        edge()
        turn(-1)
        smalledge()
        turn(-1)
        edge()
        turn(1)
        smalledge()
        turn(1)


squiggle()
edge()
turn(-1)
backwardssquiggle()
edge()
コード例 #48
0
ファイル: cleanup.py プロジェクト: jeffa5/tealight-files
def r():
  turn(1)
コード例 #49
0
ファイル: cleanup.py プロジェクト: jeffa5/tealight-files
def l():
  turn(-1)
コード例 #50
0
from tealight.robot import (move, turn, look, touch, smell, left_side,
                            right_side)

while True:
    if right_side() == 'fruit':
        turn(1)
    elif left_side() == 'fruit':
        turn(3)
    move()
コード例 #51
0
ファイル: mine.py プロジェクト: rexapex/tealight-files
def go():
    moveBy(3)
    turn(-1)
    while True:
        if right_side() or left_side():
            move()
コード例 #52
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)
コード例 #53
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
コード例 #54
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)
  
コード例 #55
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()