• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python robot.touch函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tealight.robot.touch函数的典型用法代码示例。如果您正苦于以下问题:Python touch函数的具体用法?Python touch怎么用?Python touch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了touch函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: go

def go():
    while touch() == "fruit":
        move()

    if touch() != "fruit":
        turn(3)
        go()
开发者ID:jordanc44,项目名称:tealight-files,代码行数:7,代码来源:mine.py


示例2: main

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)
开发者ID:BasRegi,项目名称:tealight-files,代码行数:8,代码来源:maze.py


示例3: left_way

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)
开发者ID:c-ryan747,项目名称:tealight-files,代码行数:9,代码来源:refuel.py


示例4: branch

def branch(dir):
  turn(dir)
  
  if touch() == 'fruit':
    while touch() == 'fruit':
      move()
  elif left_side() == 'fruit':
    branch(-1)
  elif right_side() == 'fruit':
    branch(1)
开发者ID:rexapex,项目名称:tealight-files,代码行数:10,代码来源:vine.py


示例5: test_way

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()
开发者ID:c-ryan747,项目名称:tealight-files,代码行数:12,代码来源:refuel.py


示例6: go

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()
开发者ID:clairebuckler,项目名称:tealight-files,代码行数:13,代码来源:chess.py


示例7: go

def go(dir):
  while touch() != 'fruit':
    move()
  while touch() == 'fruit':
    move()
  if dir == 1:
    while left_side() == 'fruit':
      move()
  if dir == -1:
    while right_side() == 'fruit':
      move()
  dir =dir*-1    
  turner(dir)  
开发者ID:asmith30,项目名称:tealight-files,代码行数:13,代码来源:cleanup.py


示例8: go

def go():
  move()
  if (touch()!='fruit'):
    turn(-1)
    go()
    return
  go()
开发者ID:andresarcia,项目名称:tealight-files,代码行数:7,代码来源:vine.py


示例9: go

def go():
  moved = 0
  while touch() == "fruit":
    move()
    moved = moved + 1
  
  turn(-1)
开发者ID:ddimoline,项目名称:tealight-files,代码行数:7,代码来源:vine.py


示例10: super_move

def super_move():
  if touch() != "wall":
    move()
  elif left_side() == "wall":
    turn(1)
  else:
    turn(3)
开发者ID:jonathan-dilorenzo,项目名称:tealight-files,代码行数:7,代码来源:maze.py


示例11: go

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)
开发者ID:jotirai,项目名称:tealight-files,代码行数:17,代码来源:vine.py


示例12: MoveSearch

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()
开发者ID:davidsamueljones,项目名称:tealight-files,代码行数:11,代码来源:cleanup.py


示例13: find

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()
开发者ID:asmith30,项目名称:tealight-files,代码行数:11,代码来源:palace.py


示例14: go

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()

    if touch() == "wall":
        turn(2)
        move()
        go()
开发者ID:jordanc44,项目名称:tealight-files,代码行数:20,代码来源:vine.py


示例15: lookAndMove

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()
开发者ID:willg-c,项目名称:tealight-files,代码行数:21,代码来源:trail.py


示例16: search

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)
开发者ID:Minghsien,项目名称:tealight-files,代码行数:14,代码来源:trail.py


示例17: import

from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)

while touch() == 'fruit':
  move()
  if left_side() == 'fruit':
      dir = 1
      turn(dir)
      dir = -dir
  if right_side() == 'fruit':
      dir = 1
      turn(dir)
      dir = -dir
      
  else:
    dir = 1
    turn(dir)
    dir = -dir
  
      
      
  
    

开发者ID:jackm110,项目名称:tealight-files,代码行数:23,代码来源:trail.py


示例18: import

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
开发者ID:sagelin,项目名称:tealight-files,代码行数:25,代码来源:refuel.py


示例19: import

from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)

while touch() != 'fruit':
  if left_side() == 'wall':
    if touch() != 'wall':
      move(1)
    else:
      turn(1)
  else:
    turn(-1)
    move(1)
move(1)
开发者ID:ronanmtkelly,项目名称:tealight-files,代码行数:18,代码来源:maze.py


示例20: import

from tealight.robot import (move, 
                            turn, 
                            look, 
                            touch, 
                            smell, 
                            left_side, 
                            right_side)


for i in range (0,10):
 if touch() == 'fruit':
  move()

if touch() == 'wall':
  turn(1)
  for i in range (0,10):
    move()
    
if touch() == 'wall':
 turn(-1)
 for i in range (0,20):
   move()
开发者ID:mauriceyap,项目名称:tealight-files,代码行数:22,代码来源:trail.py



注:本文中的tealight.robot.touch函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python robot.turn函数代码示例发布时间:2022-05-27
下一篇:
Python robot.move函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap