小古比鱼 发表于 2022-11-21 19:11:16

乌龟吃鱼小游戏(旧版第037讲课后作业动动手第1题)

原帖地址:https://fishc.com.cn/thread-48620-1-1.html
题目要求:按以下要求定义一个乌龟类和鱼类并尝试编写游戏。

[*]假设游戏场景为范围(x, y)为0<=x<=10,0<=y<=10
[*]游戏生成1只乌龟和10条鱼
[*]它们的移动方向均随机
[*]乌龟的最大移动能力是2(Ta可以随机选择1还是2移动),鱼儿的最大移动能力是1
[*]当移动到场景边缘,自动向反方向移动
[*]乌龟初始化体力为100(上限)
[*]乌龟每移动一次,体力消耗1
[*]当乌龟和鱼坐标重叠,乌龟吃掉鱼,乌龟体力增加20
[*]鱼暂不计算体力
[*]当乌龟体力值为0(挂掉)或者鱼儿的数量为0游戏结束

如下是小古比鱼所编的程序,参考了小甲鱼老师提供的答案,但可以实时显示乌龟和每条鱼的状态信息,每隔1秒自动输出移动一次后的结果,用户体验更好!望各位鱼友走过路过,留下宝贵意见,共同交流进步!
from random import randint,choice
from time import sleep

def bounce(x):            # 函数bounce用于防止坐标越界(实现“撞墙反弹”效果)
    if 0 <= x <= 10:
      return x
    if x > 10:
      return 20 - x
    return -x               # if x < 0

class Fish:                                                 # 定义鱼类Fish
    def __init__(self):
      (self.x,self.y) = (randint(0,10),randint(0,10))   # 构造函数初始化位置坐标(0 ≤ x,y ≤ 10)
    def getp(self):
      return (self.x,self.y)                              # 函数getp返回对象当前位置
    def move(self):
      dir = choice(((0,1),(0,-1),(-1,0),(1,0)))         # 移动方向随机(上、下、左、右)
      self.x = bounce(self.x + dir)
      self.y = bounce(self.y + dir)                  # 鱼儿每次移动1格
      return self                                       # 返回对象自身以便使用

class Turtle(Fish):                                       # 定义乌龟类Turtle,继承自鱼类
    def __init__(self):
      super().__init__()                                  # 调用鱼类的构造函数初始化位置坐标
      self.health = 100                                 # 初始化乌龟体力为100(上限)
    def move(self):
      dir = choice(((0,1),(0,-1),(-1,0),(1,0)))         # 移动方向随机(上、下、左、右)
      self.x = bounce(self.x + dir * choice((1,2)))
      self.y = bounce(self.y + dir * choice((1,2)))    # 乌龟每次随机移动1格或2格
      self.health -= 1                                    # 每移动一次消耗1点体力
    def eat(self):
      self.health = min(self.health+20,100)               # 乌龟每吃一条鱼体力增加20(不超过100)

def Game():
    def getstate(turtle,fishes):                                             # 函数getstate用于打印当前状态
      print(f'乌龟:{turtle.getp()} | 体力:{turtle.health}\n' \
            f'鱼:{len(fishes)}条 | {}')
    def eatcheck(turtle,fishes):                                             # 函数eatcheck用于检测坐标重合
      for f in range(len(fishes)-1,-1,-1):                                 # 从后往前遍历每一条鱼(不易出bug)
            if turtle.getp() == fishes.getp():                            # 若该鱼的坐标与乌龟的坐标重合
                turtle.eat()                                                 # 乌龟就会将该鱼吃掉
                fishes.pop(f)
                print(f'乌龟吃掉了第{f+1}条鱼!体力恢复至{turtle.health}!')
      return len(fishes) >= 1                                              # 返回当前是否有鱼

    turtle = Turtle()                               # 初始化1只乌龟
    fishes =             # 初始化10只鱼
    moves = 0                                       # 移动次数为moves
    print('游戏开始!')
    getstate(turtle,fishes)
    while True:
      if not eatcheck(turtle,fishes):             # 若当前鱼的数量为0
            print('所有的鱼均被吃光,游戏结束!')   # 游戏结束
            break
      sleep(1)                                    # 每过1秒移动一次
      moves += 1
      print(f'\n移动{moves}次后:')
      turtle.move()                               # 乌龟移动
      fishes =    # 10只鱼各自移动
      getstate(turtle,fishes)
      if not turtle.health:                     # 若乌龟的体力为0
            print('乌龟的体力已耗尽,游戏结束!')   # 游戏结束
            break

Game()   # 开始游戏
输出结果:
游戏开始!
乌龟:(9, 9) | 体力:100
鱼:10条 | [(0, 9), (6, 3), (2, 7), (1, 4), (3, 2), (4, 8), (8, 1), (2, 4), (1, 10), (7, 1)]

移动1次后:
乌龟:(9, 8) | 体力:99
鱼:10条 | [(1, 9), (6, 2), (1, 7), (0, 4), (3, 3), (5, 8), (9, 1), (3, 4), (0, 10), (7, 2)]

移动2次后:
乌龟:(10, 8) | 体力:98
鱼:10条 | [(0, 9), (5, 2), (2, 7), (0, 5), (2, 3), (4, 8), (10, 1), (3, 3), (1, 10), (7, 3)]

移动3次后:
乌龟:(8, 8) | 体力:97
鱼:10条 | [(1, 9), (5, 1), (2, 8), (1, 5), (2, 2), (4, 7), (9, 1), (4, 3), (1, 9), (8, 3)]

移动4次后:
乌龟:(7, 8) | 体力:96
鱼:10条 | [(2, 9), (5, 0), (1, 8), (0, 5), (1, 2), (4, 6), (10, 1), (3, 3), (0, 9), (9, 3)]

移动5次后:
乌龟:(7, 9) | 体力:95
鱼:10条 | [(3, 9), (4, 0), (2, 8), (0, 6), (1, 3), (5, 6), (10, 2), (3, 2), (1, 9), (9, 2)]

移动6次后:
乌龟:(7, 8) | 体力:94
鱼:10条 | [(2, 9), (5, 0), (2, 9), (0, 7), (2, 3), (6, 6), (9, 2), (3, 1), (1, 10), (9, 3)]

移动7次后:
乌龟:(9, 8) | 体力:93
鱼:10条 | [(3, 9), (6, 0), (2, 10), (1, 7), (2, 2), (6, 7), (10, 2), (3, 0), (2, 10), (10, 3)]

移动8次后:
乌龟:(9, 6) | 体力:92
鱼:10条 | [(3, 10), (6, 1), (1, 10), (1, 6), (2, 3), (6, 8), (10, 3), (4, 0), (2, 9), (10, 2)]

移动9次后:
乌龟:(9, 8) | 体力:91
鱼:10条 | [(3, 9), (6, 2), (1, 9), (2, 6), (2, 2), (6, 7), (10, 2), (5, 0), (3, 9), (9, 2)]

移动10次后:
乌龟:(9, 9) | 体力:90
鱼:10条 | [(3, 8), (5, 2), (2, 9), (2, 7), (3, 2), (7, 7), (9, 2), (5, 1), (3, 10), (10, 2)]

移动11次后:
乌龟:(9, 9) | 体力:89
鱼:10条 | [(3, 7), (4, 2), (2, 8), (1, 7), (2, 2), (8, 7), (8, 2), (5, 0), (2, 10), (9, 2)]

移动12次后:
乌龟:(10, 9) | 体力:88
鱼:10条 | [(3, 8), (4, 3), (1, 8), (1, 6), (2, 1), (8, 8), (8, 3), (5, 1), (2, 9), (10, 2)]

移动13次后:
乌龟:(10, 7) | 体力:87
鱼:10条 | [(4, 8), (4, 4), (1, 9), (1, 5), (2, 0), (9, 8), (8, 2), (4, 1), (2, 8), (9, 2)]

移动14次后:
乌龟:(8, 7) | 体力:86
鱼:10条 | [(5, 8), (3, 4), (0, 9), (2, 5), (2, 1), (10, 8), (8, 3), (4, 2), (2, 9), (10, 2)]

移动15次后:
乌龟:(8, 6) | 体力:85
鱼:10条 | [(5, 7), (4, 4), (1, 9), (1, 5), (1, 1), (10, 9), (7, 3), (4, 3), (1, 9), (10, 3)]

移动16次后:
乌龟:(8, 8) | 体力:84
鱼:10条 | [(5, 8), (3, 4), (1, 10), (1, 6), (1, 2), (9, 9), (7, 4), (4, 2), (1, 10), (10, 2)]

移动17次后:
乌龟:(8, 10) | 体力:83
鱼:10条 | [(4, 8), (4, 4), (2, 10), (0, 6), (1, 3), (8, 9), (8, 4), (3, 2), (2, 10), (10, 1)]

移动18次后:
乌龟:(6, 10) | 体力:82
鱼:10条 | [(3, 8), (3, 4), (1, 10), (0, 5), (0, 3), (8, 8), (7, 4), (4, 2), (2, 9), (10, 2)]

移动19次后:
乌龟:(6, 9) | 体力:81
鱼:10条 | [(3, 7), (4, 4), (0, 10), (1, 5), (0, 4), (7, 8), (6, 4), (4, 3), (3, 9), (10, 1)]

移动20次后:
乌龟:(6, 8) | 体力:80
鱼:10条 | [(3, 8), (3, 4), (1, 10), (2, 5), (1, 4), (7, 9), (6, 5), (4, 4), (4, 9), (9, 1)]

移动21次后:
乌龟:(6, 10) | 体力:79
鱼:10条 | [(4, 8), (4, 4), (1, 9), (3, 5), (0, 4), (7, 8), (6, 6), (3, 4), (3, 9), (9, 0)]

移动22次后:
乌龟:(4, 10) | 体力:78
鱼:10条 | [(5, 8), (4, 3), (0, 9), (3, 4), (0, 3), (6, 8), (5, 6), (3, 5), (3, 8), (9, 1)]

移动23次后:
乌龟:(4, 8) | 体力:77
鱼:10条 | [(5, 9), (3, 3), (0, 10), (3, 5), (1, 3), (6, 9), (4, 6), (3, 4), (3, 9), (10, 1)]

移动24次后:
乌龟:(4, 7) | 体力:76
鱼:10条 | [(5, 8), (2, 3), (0, 9), (3, 6), (1, 2), (6, 10), (3, 6), (2, 4), (3, 10), (10, 0)]

移动25次后:
乌龟:(4, 9) | 体力:75
鱼:10条 | [(6, 8), (1, 3), (1, 9), (3, 7), (1, 1), (6, 9), (2, 6), (3, 4), (4, 10), (9, 0)]

移动26次后:
乌龟:(4, 7) | 体力:74
鱼:10条 | [(7, 8), (1, 2), (1, 8), (2, 7), (2, 1), (6, 8), (2, 7), (2, 4), (5, 10), (9, 1)]

移动27次后:
乌龟:(5, 7) | 体力:73
鱼:10条 | [(8, 8), (1, 3), (1, 9), (2, 6), (2, 2), (5, 8), (2, 6), (1, 4), (4, 10), (10, 1)]

移动28次后:
乌龟:(4, 7) | 体力:72
鱼:10条 | [(9, 8), (1, 4), (0, 9), (2, 5), (1, 2), (4, 8), (2, 7), (0, 4), (5, 10), (9, 1)]

移动29次后:
乌龟:(5, 7) | 体力:71
鱼:10条 | [(8, 8), (0, 4), (0, 8), (3, 5), (0, 2), (4, 9), (2, 6), (1, 4), (6, 10), (8, 1)]

移动30次后:
乌龟:(5, 5) | 体力:70
鱼:10条 | [(9, 8), (1, 4), (0, 7), (2, 5), (1, 2), (4, 8), (2, 7), (0, 4), (6, 9), (7, 1)]

移动31次后:
乌龟:(4, 5) | 体力:69
鱼:10条 | [(9, 7), (1, 3), (1, 7), (3, 5), (1, 1), (3, 8), (2, 6), (1, 4), (5, 9), (7, 0)]

移动32次后:
乌龟:(3, 5) | 体力:68
鱼:10条 | [(10, 7), (2, 3), (0, 7), (4, 5), (0, 1), (2, 8), (2, 7), (2, 4), (5, 10), (8, 0)]

移动33次后:
乌龟:(2, 5) | 体力:67
鱼:10条 | [(10, 6), (1, 3), (1, 7), (3, 5), (0, 2), (2, 9), (3, 7), (3, 4), (5, 9), (9, 0)]

移动34次后:
乌龟:(2, 7) | 体力:66
鱼:10条 | [(10, 7), (1, 2), (1, 8), (4, 5), (1, 2), (2, 8), (3, 6), (3, 5), (5, 10), (10, 0)]

移动35次后:
乌龟:(1, 7) | 体力:65
鱼:10条 | [(10, 6), (0, 2), (1, 9), (5, 5), (0, 2), (2, 9), (2, 6), (4, 5), (6, 10), (10, 1)]

移动36次后:
乌龟:(3, 7) | 体力:64
鱼:10条 | [(10, 7), (0, 3), (1, 8), (4, 5), (0, 1), (2, 10), (3, 6), (5, 5), (6, 9), (9, 1)]

移动37次后:
乌龟:(1, 7) | 体力:63
鱼:10条 | [(10, 6), (1, 3), (1, 9), (4, 4), (0, 0), (1, 10), (3, 5), (6, 5), (7, 9), (9, 2)]

移动38次后:
乌龟:(1, 9) | 体力:62
鱼:10条 | [(9, 6), (1, 4), (0, 9), (4, 5), (1, 0), (1, 9), (2, 5), (7, 5), (8, 9), (9, 1)]
乌龟吃掉了第6条鱼!体力恢复至82!

移动39次后:
乌龟:(1, 7) | 体力:81
鱼:9条 | [(8, 6), (1, 3), (1, 9), (4, 4), (0, 0), (3, 5), (7, 4), (7, 9), (9, 0)]

移动40次后:
乌龟:(0, 7) | 体力:80
鱼:9条 | [(8, 5), (1, 2), (1, 8), (4, 3), (1, 0), (3, 4), (7, 5), (6, 9), (10, 0)]

移动41次后:
乌龟:(2, 7) | 体力:79
鱼:9条 | [(8, 6), (1, 3), (1, 7), (3, 3), (2, 0), (3, 3), (7, 6), (6, 8), (9, 0)]

移动42次后:
乌龟:(0, 7) | 体力:78
鱼:9条 | [(8, 7), (1, 4), (1, 6), (3, 2), (1, 0), (4, 3), (7, 5), (6, 9), (9, 1)]

移动43次后:
乌龟:(1, 7) | 体力:77
鱼:9条 | [(8, 6), (1, 3), (2, 6), (4, 2), (1, 1), (4, 4), (7, 4), (7, 9), (10, 1)]

移动44次后:
乌龟:(1, 9) | 体力:76
鱼:9条 | [(8, 7), (1, 4), (1, 6), (5, 2), (2, 1), (5, 4), (8, 4), (7, 10), (10, 0)]

移动45次后:
乌龟:(1, 7) | 体力:75
鱼:9条 | [(8, 6), (2, 4), (1, 7), (5, 3), (3, 1), (6, 4), (8, 3), (7, 9), (9, 0)]
乌龟吃掉了第3条鱼!体力恢复至95!

移动46次后:
乌龟:(1, 8) | 体力:94
鱼:8条 | [(8, 7), (1, 4), (5, 2), (4, 1), (6, 3), (9, 3), (7, 10), (9, 1)]

移动47次后:
乌龟:(1, 6) | 体力:93
鱼:8条 | [(9, 7), (2, 4), (6, 2), (5, 1), (5, 3), (8, 3), (6, 10), (9, 0)]

移动48次后:
乌龟:(2, 6) | 体力:92
鱼:8条 | [(8, 7), (1, 4), (6, 1), (5, 2), (4, 3), (7, 3), (5, 10), (8, 0)]

移动49次后:
乌龟:(3, 6) | 体力:91
鱼:8条 | [(7, 7), (1, 5), (6, 2), (6, 2), (4, 2), (8, 3), (5, 9), (7, 0)]

移动50次后:
乌龟:(2, 6) | 体力:90
鱼:8条 | [(6, 7), (0, 5), (7, 2), (5, 2), (5, 2), (7, 3), (5, 10), (8, 0)]

移动51次后:
乌龟:(2, 5) | 体力:89
鱼:8条 | [(7, 7), (1, 5), (6, 2), (5, 1), (4, 2), (6, 3), (4, 10), (7, 0)]

移动52次后:
乌龟:(3, 5) | 体力:88
鱼:8条 | [(7, 8), (1, 6), (5, 2), (5, 2), (3, 2), (5, 3), (4, 9), (7, 1)]

移动53次后:
乌龟:(4, 5) | 体力:87
鱼:8条 | [(8, 8), (1, 5), (4, 2), (4, 2), (4, 2), (6, 3), (5, 9), (6, 1)]

移动54次后:
乌龟:(4, 6) | 体力:86
鱼:8条 | [(9, 8), (0, 5), (5, 2), (5, 2), (3, 2), (6, 2), (4, 9), (6, 2)]

移动55次后:
乌龟:(3, 6) | 体力:85
鱼:8条 | [(10, 8), (0, 4), (4, 2), (5, 1), (3, 3), (7, 2), (4, 10), (7, 2)]

移动56次后:
乌龟:(1, 6) | 体力:84
鱼:8条 | [(9, 8), (1, 4), (4, 1), (5, 2), (3, 4), (8, 2), (4, 9), (6, 2)]

移动57次后:
乌龟:(1, 8) | 体力:83
鱼:8条 | [(8, 8), (2, 4), (4, 0), (5, 1), (3, 5), (8, 1), (3, 9), (6, 3)]

移动58次后:
乌龟:(3, 8) | 体力:82
鱼:8条 | [(8, 7), (2, 3), (5, 0), (4, 1), (2, 5), (9, 1), (4, 9), (5, 3)]

移动59次后:
乌龟:(1, 8) | 体力:81
鱼:8条 | [(9, 7), (2, 4), (5, 1), (3, 1), (3, 5), (10, 1), (4, 10), (6, 3)]

移动60次后:
乌龟:(3, 8) | 体力:80
鱼:8条 | [(9, 8), (3, 4), (6, 1), (2, 1), (3, 4), (10, 0), (4, 9), (6, 4)]

移动61次后:
乌龟:(3, 6) | 体力:79
鱼:8条 | [(10, 8), (3, 3), (6, 0), (2, 0), (2, 4), (10, 1), (3, 9), (5, 4)]

移动62次后:
乌龟:(2, 6) | 体力:78
鱼:8条 | [(9, 8), (3, 4), (7, 0), (1, 0), (3, 4), (10, 0), (2, 9), (6, 4)]

移动63次后:
乌龟:(1, 6) | 体力:77
鱼:8条 | [(10, 8), (3, 5), (7, 1), (0, 0), (2, 4), (9, 0), (2, 10), (6, 5)]

移动64次后:
乌龟:(2, 6) | 体力:76
鱼:8条 | [(10, 7), (4, 5), (6, 1), (0, 1), (2, 3), (9, 1), (2, 9), (5, 5)]

移动65次后:
乌龟:(1, 6) | 体力:75
鱼:8条 | [(10, 8), (4, 4), (7, 1), (0, 2), (2, 2), (10, 1), (1, 9), (5, 4)]

移动66次后:
乌龟:(2, 6) | 体力:74
鱼:8条 | [(10, 7), (4, 5), (8, 1), (0, 3), (3, 2), (9, 1), (2, 9), (5, 3)]

移动67次后:
乌龟:(0, 6) | 体力:73
鱼:8条 | [(9, 7), (4, 6), (7, 1), (1, 3), (3, 3), (9, 0), (1, 9), (5, 2)]

移动68次后:
乌龟:(1, 6) | 体力:72
鱼:8条 | [(9, 6), (5, 6), (7, 0), (1, 2), (3, 4), (8, 0), (1, 8), (5, 3)]

移动69次后:
乌龟:(1, 7) | 体力:71
鱼:8条 | [(8, 6), (5, 5), (8, 0), (0, 2), (4, 4), (8, 1), (0, 8), (5, 2)]

移动70次后:
乌龟:(2, 7) | 体力:70
鱼:8条 | [(8, 7), (4, 5), (8, 1), (0, 3), (4, 5), (7, 1), (0, 9), (5, 3)]

移动71次后:
乌龟:(3, 7) | 体力:69
鱼:8条 | [(7, 7), (4, 4), (8, 2), (1, 3), (3, 5), (7, 0), (0, 8), (6, 3)]

移动72次后:
乌龟:(3, 8) | 体力:68
鱼:8条 | [(7, 8), (4, 3), (8, 1), (2, 3), (2, 5), (7, 1), (1, 8), (6, 2)]

移动73次后:
乌龟:(1, 8) | 体力:67
鱼:8条 | [(8, 8), (4, 2), (7, 1), (2, 4), (3, 5), (7, 2), (1, 7), (5, 2)]

移动74次后:
乌龟:(0, 8) | 体力:66
鱼:8条 | [(8, 7), (3, 2), (8, 1), (1, 4), (4, 5), (7, 1), (1, 8), (5, 3)]

移动75次后:
乌龟:(2, 8) | 体力:65
鱼:8条 | [(7, 7), (3, 3), (7, 1), (1, 5), (4, 6), (6, 1), (1, 7), (4, 3)]

移动76次后:
乌龟:(2, 6) | 体力:64
鱼:8条 | [(8, 7), (4, 3), (6, 1), (1, 4), (5, 6), (5, 1), (1, 6), (5, 3)]

移动77次后:
乌龟:(3, 6) | 体力:63
鱼:8条 | [(9, 7), (4, 2), (6, 2), (1, 5), (5, 7), (5, 0), (0, 6), (5, 2)]

移动78次后:
乌龟:(1, 6) | 体力:62
鱼:8条 | [(9, 6), (5, 2), (6, 1), (0, 5), (5, 6), (4, 0), (1, 6), (5, 1)]
乌龟吃掉了第7条鱼!体力恢复至82!

移动79次后:
乌龟:(1, 4) | 体力:81
鱼:7条 | [(10, 6), (6, 2), (6, 0), (1, 5), (6, 6), (4, 1), (4, 1)]

移动80次后:
乌龟:(1, 6) | 体力:80
鱼:7条 | [(9, 6), (6, 3), (6, 1), (2, 5), (6, 7), (4, 2), (4, 2)]

移动81次后:
乌龟:(1, 8) | 体力:79
鱼:7条 | [(10, 6), (5, 3), (6, 0), (3, 5), (5, 7), (4, 1), (3, 2)]

移动82次后:
乌龟:(1, 10) | 体力:78
鱼:7条 | [(10, 5), (6, 3), (7, 0), (3, 6), (5, 6), (3, 1), (3, 3)]

移动83次后:
乌龟:(1, 9) | 体力:77
鱼:7条 | [(9, 5), (5, 3), (8, 0), (2, 6), (4, 6), (2, 1), (3, 2)]

移动84次后:
乌龟:(1, 9) | 体力:76
鱼:7条 | [(9, 4), (5, 2), (8, 1), (3, 6), (3, 6), (2, 2), (3, 3)]

移动85次后:
乌龟:(1, 9) | 体力:75
鱼:7条 | [(9, 3), (5, 1), (7, 1), (4, 6), (3, 5), (1, 2), (3, 4)]

移动86次后:
乌龟:(0, 9) | 体力:74
鱼:7条 | [(9, 2), (6, 1), (6, 1), (4, 7), (2, 5), (1, 1), (3, 5)]

移动87次后:
乌龟:(2, 9) | 体力:73
鱼:7条 | [(9, 1), (5, 1), (5, 1), (5, 7), (2, 6), (0, 1), (4, 5)]

移动88次后:
乌龟:(2, 7) | 体力:72
鱼:7条 | [(9, 2), (4, 1), (6, 1), (6, 7), (2, 5), (1, 1), (3, 5)]

移动89次后:
乌龟:(4, 7) | 体力:71
鱼:7条 | [(9, 3), (5, 1), (6, 0), (5, 7), (2, 4), (1, 2), (2, 5)]

移动90次后:
乌龟:(4, 9) | 体力:70
鱼:7条 | [(9, 2), (4, 1), (7, 0), (6, 7), (1, 4), (1, 3), (2, 4)]

移动91次后:
乌龟:(4, 7) | 体力:69
鱼:7条 | [(8, 2), (5, 1), (6, 0), (5, 7), (1, 5), (0, 3), (2, 3)]

移动92次后:
乌龟:(4, 6) | 体力:68
鱼:7条 | [(7, 2), (4, 1), (5, 0), (4, 7), (1, 6), (0, 2), (2, 4)]

移动93次后:
乌龟:(4, 4) | 体力:67
鱼:7条 | [(8, 2), (4, 2), (5, 1), (4, 8), (0, 6), (0, 1), (1, 4)]

移动94次后:
乌龟:(4, 5) | 体力:66
鱼:7条 | [(8, 1), (4, 1), (5, 2), (5, 8), (0, 7), (1, 1), (1, 3)]

移动95次后:
乌龟:(6, 5) | 体力:65
鱼:7条 | [(9, 1), (5, 1), (5, 3), (6, 8), (1, 7), (0, 1), (1, 4)]

移动96次后:
乌龟:(6, 7) | 体力:64
鱼:7条 | [(10, 1), (6, 1), (5, 4), (7, 8), (0, 7), (0, 0), (1, 3)]

移动97次后:
乌龟:(6, 6) | 体力:63
鱼:7条 | [(10, 0), (7, 1), (5, 5), (7, 7), (1, 7), (1, 0), (2, 3)]

移动98次后:
乌龟:(4, 6) | 体力:62
鱼:7条 | [(10, 1), (6, 1), (6, 5), (7, 8), (2, 7), (1, 1), (1, 3)]

移动99次后:
乌龟:(2, 6) | 体力:61
鱼:7条 | [(10, 0), (7, 1), (5, 5), (6, 8), (2, 6), (1, 0), (1, 4)]
乌龟吃掉了第5条鱼!体力恢复至81!

移动100次后:
乌龟:(4, 6) | 体力:80
鱼:6条 | [(10, 1), (7, 0), (6, 5), (7, 8), (1, 1), (1, 3)]

移动101次后:
乌龟:(4, 8) | 体力:79
鱼:6条 | [(10, 2), (7, 1), (5, 5), (6, 8), (0, 1), (2, 3)]

移动102次后:
乌龟:(4, 6) | 体力:78
鱼:6条 | [(10, 1), (6, 1), (5, 6), (6, 7), (1, 1), (2, 4)]

移动103次后:
乌龟:(4, 7) | 体力:77
鱼:6条 | [(10, 2), (7, 1), (5, 7), (6, 8), (0, 1), (1, 4)]

移动104次后:
乌龟:(4, 9) | 体力:76
鱼:6条 | [(10, 3), (8, 1), (5, 6), (5, 8), (0, 0), (1, 5)]

移动105次后:
乌龟:(2, 9) | 体力:75
鱼:6条 | [(10, 2), (8, 0), (5, 5), (5, 9), (0, 1), (2, 5)]

移动106次后:
乌龟:(1, 9) | 体力:74
鱼:6条 | [(9, 2), (8, 1), (6, 5), (5, 8), (0, 2), (2, 6)]

移动107次后:
乌龟:(2, 9) | 体力:73
鱼:6条 | [(8, 2), (8, 2), (6, 6), (6, 8), (0, 1), (2, 5)]

移动108次后:
乌龟:(0, 9) | 体力:72
鱼:6条 | [(8, 3), (8, 3), (5, 6), (6, 9), (0, 2), (3, 5)]

移动109次后:
乌龟:(0, 9) | 体力:71
鱼:6条 | [(7, 3), (8, 4), (4, 6), (5, 9), (0, 1), (3, 4)]

移动110次后:
乌龟:(0, 8) | 体力:70
鱼:6条 | [(8, 3), (8, 5), (3, 6), (5, 10), (1, 1), (3, 3)]

移动111次后:
乌龟:(2, 8) | 体力:69
鱼:6条 | [(8, 2), (9, 5), (3, 5), (6, 10), (1, 0), (4, 3)]

移动112次后:
乌龟:(2, 7) | 体力:68
鱼:6条 | [(8, 1), (9, 6), (4, 5), (6, 9), (2, 0), (4, 4)]

移动113次后:
乌龟:(2, 6) | 体力:67
鱼:6条 | [(9, 1), (9, 7), (4, 6), (6, 8), (2, 1), (3, 4)]

移动114次后:
乌龟:(2, 4) | 体力:66
鱼:6条 | [(8, 1), (8, 7), (5, 6), (6, 9), (3, 1), (2, 4)]
乌龟吃掉了第6条鱼!体力恢复至86!

移动115次后:
乌龟:(4, 4) | 体力:85
鱼:5条 | [(9, 1), (7, 7), (6, 6), (6, 10), (3, 0)]

移动116次后:
乌龟:(3, 4) | 体力:84
鱼:5条 | [(8, 1), (7, 6), (5, 6), (6, 9), (4, 0)]

移动117次后:
乌龟:(4, 4) | 体力:83
鱼:5条 | [(8, 2), (8, 6), (5, 5), (7, 9), (3, 0)]

移动118次后:
乌龟:(4, 3) | 体力:82
鱼:5条 | [(8, 3), (9, 6), (5, 6), (8, 9), (3, 1)]

移动119次后:
乌龟:(2, 3) | 体力:81
鱼:5条 | [(7, 3), (10, 6), (5, 7), (8, 10), (3, 2)]

移动120次后:
乌龟:(4, 3) | 体力:80
鱼:5条 | [(8, 3), (10, 7), (6, 7), (8, 9), (4, 2)]

移动121次后:
乌龟:(2, 3) | 体力:79
鱼:5条 | [(7, 3), (10, 6), (6, 6), (8, 8), (5, 2)]

移动122次后:
乌龟:(2, 4) | 体力:78
鱼:5条 | [(8, 3), (9, 6), (5, 6), (9, 8), (5, 1)]

移动123次后:
乌龟:(1, 4) | 体力:77
鱼:5条 | [(8, 2), (10, 6), (4, 6), (9, 9), (6, 1)]

移动124次后:
乌龟:(0, 4) | 体力:76
鱼:5条 | [(8, 3), (10, 7), (4, 5), (9, 8), (5, 1)]

移动125次后:
乌龟:(2, 4) | 体力:75
鱼:5条 | [(7, 3), (10, 6), (3, 5), (9, 7), (4, 1)]

移动126次后:
乌龟:(1, 4) | 体力:74
鱼:5条 | [(8, 3), (9, 6), (3, 6), (9, 6), (5, 1)]

移动127次后:
乌龟:(1, 3) | 体力:73
鱼:5条 | [(9, 3), (9, 5), (3, 5), (10, 6), (5, 0)]

移动128次后:
乌龟:(2, 3) | 体力:72
鱼:5条 | [(10, 3), (9, 6), (2, 5), (10, 5), (4, 0)]

移动129次后:
乌龟:(0, 3) | 体力:71
鱼:5条 | [(10, 2), (9, 7), (2, 6), (9, 5), (4, 1)]

移动130次后:
乌龟:(1, 3) | 体力:70
鱼:5条 | [(9, 2), (9, 8), (2, 7), (9, 4), (3, 1)]

移动131次后:
乌龟:(3, 3) | 体力:69
鱼:5条 | [(10, 2), (9, 9), (3, 7), (9, 3), (2, 1)]

移动132次后:
乌龟:(3, 5) | 体力:68
鱼:5条 | [(9, 2), (8, 9), (2, 7), (10, 3), (3, 1)]

移动133次后:
乌龟:(1, 5) | 体力:67
鱼:5条 | [(10, 2), (8, 8), (1, 7), (10, 4), (2, 1)]

移动134次后:
乌龟:(0, 5) | 体力:66
鱼:5条 | [(9, 2), (7, 8), (1, 6), (10, 5), (2, 2)]

移动135次后:
乌龟:(0, 3) | 体力:65
鱼:5条 | [(9, 3), (7, 9), (0, 6), (9, 5), (2, 1)]

移动136次后:
乌龟:(0, 4) | 体力:64
鱼:5条 | [(9, 4), (7, 10), (1, 6), (8, 5), (2, 0)]

移动137次后:
乌龟:(1, 4) | 体力:63
鱼:5条 | [(9, 5), (7, 9), (1, 5), (8, 6), (2, 1)]

移动138次后:
乌龟:(1, 6) | 体力:62
鱼:5条 | [(9, 6), (7, 10), (1, 6), (8, 5), (2, 2)]
乌龟吃掉了第3条鱼!体力恢复至82!

移动139次后:
乌龟:(1, 5) | 体力:81
鱼:4条 | [(10, 6), (7, 9), (7, 5), (1, 2)]

移动140次后:
乌龟:(1, 7) | 体力:80
鱼:4条 | [(10, 7), (8, 9), (6, 5), (0, 2)]

移动141次后:
乌龟:(1, 5) | 体力:79
鱼:4条 | [(9, 7), (9, 9), (7, 5), (0, 3)]

移动142次后:
乌龟:(1, 3) | 体力:78
鱼:4条 | [(8, 7), (9, 8), (6, 5), (0, 4)]

移动143次后:
乌龟:(1, 3) | 体力:77
鱼:4条 | [(9, 7), (10, 8), (6, 6), (1, 4)]

移动144次后:
乌龟:(0, 3) | 体力:76
鱼:4条 | [(9, 6), (10, 9), (6, 7), (2, 4)]

移动145次后:
乌龟:(0, 4) | 体力:75
鱼:4条 | [(9, 7), (9, 9), (6, 8), (1, 4)]

移动146次后:
乌龟:(1, 4) | 体力:74
鱼:4条 | [(8, 7), (8, 9), (6, 7), (2, 4)]

移动147次后:
乌龟:(3, 4) | 体力:73
鱼:4条 | [(9, 7), (7, 9), (7, 7), (3, 4)]
乌龟吃掉了第4条鱼!体力恢复至93!

移动148次后:
乌龟:(3, 5) | 体力:92
鱼:3条 | [(9, 6), (7, 10), (7, 6)]

移动149次后:
乌龟:(3, 7) | 体力:91
鱼:3条 | [(9, 5), (7, 9), (7, 7)]

移动150次后:
乌龟:(3, 8) | 体力:90
鱼:3条 | [(10, 5), (7, 10), (7, 6)]

移动151次后:
乌龟:(4, 8) | 体力:89
鱼:3条 | [(10, 6), (8, 10), (7, 5)]

移动152次后:
乌龟:(4, 7) | 体力:88
鱼:3条 | [(10, 7), (9, 10), (7, 4)]

移动153次后:
乌龟:(3, 7) | 体力:87
鱼:3条 | [(10, 6), (10, 10), (6, 4)]

移动154次后:
乌龟:(4, 7) | 体力:86
鱼:3条 | [(10, 7), (10, 9), (6, 3)]

移动155次后:
乌龟:(4, 5) | 体力:85
鱼:3条 | [(10, 8), (9, 9), (6, 4)]

移动156次后:
乌龟:(4, 7) | 体力:84
鱼:3条 | [(10, 9), (8, 9), (6, 5)]

移动157次后:
乌龟:(6, 7) | 体力:83
鱼:3条 | [(10, 8), (8, 10), (7, 5)]

移动158次后:
乌龟:(7, 7) | 体力:82
鱼:3条 | [(9, 8), (7, 10), (6, 5)]

移动159次后:
乌龟:(9, 7) | 体力:81
鱼:3条 | [(9, 9), (6, 10), (6, 6)]

移动160次后:
乌龟:(9, 7) | 体力:80
鱼:3条 | [(10, 9), (7, 10), (6, 5)]

移动161次后:
乌龟:(10, 7) | 体力:79
鱼:3条 | [(10, 10), (7, 9), (6, 6)]

移动162次后:
乌龟:(10, 8) | 体力:78
鱼:3条 | [(10, 9), (7, 10), (6, 5)]

移动163次后:
乌龟:(10, 7) | 体力:77
鱼:3条 | [(10, 8), (8, 10), (6, 6)]

移动164次后:
乌龟:(10, 6) | 体力:76
鱼:3条 | [(10, 7), (7, 10), (6, 7)]

移动165次后:
乌龟:(9, 6) | 体力:75
鱼:3条 | [(10, 8), (8, 10), (6, 8)]

移动166次后:
乌龟:(7, 6) | 体力:74
鱼:3条 | [(10, 9), (8, 9), (7, 8)]

移动167次后:
乌龟:(7, 5) | 体力:73
鱼:3条 | [(10, 10), (7, 9), (8, 8)]

移动168次后:
乌龟:(7, 3) | 体力:72
鱼:3条 | [(9, 10), (7, 8), (7, 8)]

移动169次后:
乌龟:(5, 3) | 体力:71
鱼:3条 | [(10, 10), (8, 8), (7, 9)]

移动170次后:
乌龟:(6, 3) | 体力:70
鱼:3条 | [(9, 10), (8, 7), (8, 9)]

移动171次后:
乌龟:(6, 2) | 体力:69
鱼:3条 | [(10, 10), (9, 7), (8, 10)]

移动172次后:
乌龟:(6, 1) | 体力:68
鱼:3条 | [(10, 9), (9, 6), (7, 10)]

移动173次后:
乌龟:(5, 1) | 体力:67
鱼:3条 | [(10, 8), (8, 6), (7, 9)]

移动174次后:
乌龟:(7, 1) | 体力:66
鱼:3条 | [(10, 9), (8, 5), (8, 9)]

移动175次后:
乌龟:(7, 3) | 体力:65
鱼:3条 | [(10, 8), (8, 6), (9, 9)]

移动176次后:
乌龟:(7, 4) | 体力:64
鱼:3条 | [(9, 8), (9, 6), (8, 9)]

移动177次后:
乌龟:(6, 4) | 体力:63
鱼:3条 | [(9, 7), (10, 6), (8, 10)]

移动178次后:
乌龟:(4, 4) | 体力:62
鱼:3条 | [(9, 8), (9, 6), (8, 9)]

移动179次后:
乌龟:(3, 4) | 体力:61
鱼:3条 | [(10, 8), (8, 6), (7, 9)]

移动180次后:
乌龟:(3, 5) | 体力:60
鱼:3条 | [(10, 7), (8, 7), (6, 9)]

移动181次后:
乌龟:(1, 5) | 体力:59
鱼:3条 | [(9, 7), (8, 6), (6, 8)]

移动182次后:
乌龟:(1, 4) | 体力:58
鱼:3条 | [(10, 7), (8, 5), (5, 8)]

移动183次后:
乌龟:(2, 4) | 体力:57
鱼:3条 | [(10, 6), (9, 5), (5, 9)]

移动184次后:
乌龟:(4, 4) | 体力:56
鱼:3条 | [(10, 5), (8, 5), (6, 9)]

移动185次后:
乌龟:(5, 4) | 体力:55
鱼:3条 | [(10, 6), (7, 5), (6, 10)]

移动186次后:
乌龟:(4, 4) | 体力:54
鱼:3条 | [(9, 6), (6, 5), (5, 10)]

移动187次后:
乌龟:(5, 4) | 体力:53
鱼:3条 | [(9, 7), (7, 5), (5, 9)]

移动188次后:
乌龟:(5, 6) | 体力:52
鱼:3条 | [(10, 7), (6, 5), (5, 8)]

移动189次后:
乌龟:(7, 6) | 体力:51
鱼:3条 | [(9, 7), (5, 5), (6, 8)]

移动190次后:
乌龟:(5, 6) | 体力:50
鱼:3条 | [(9, 6), (5, 6), (7, 8)]
乌龟吃掉了第2条鱼!体力恢复至70!

移动191次后:
乌龟:(7, 6) | 体力:69
鱼:2条 | [(8, 6), (8, 8)]

移动192次后:
乌龟:(7, 5) | 体力:68
鱼:2条 | [(8, 5), (9, 8)]

移动193次后:
乌龟:(9, 5) | 体力:67
鱼:2条 | [(8, 4), (8, 8)]

移动194次后:
乌龟:(9, 5) | 体力:66
鱼:2条 | [(7, 4), (9, 8)]

移动195次后:
乌龟:(9, 6) | 体力:65
鱼:2条 | [(6, 4), (9, 7)]

移动196次后:
乌龟:(7, 6) | 体力:64
鱼:2条 | [(5, 4), (9, 8)]

移动197次后:
乌龟:(7, 7) | 体力:63
鱼:2条 | [(5, 5), (8, 8)]

移动198次后:
乌龟:(6, 7) | 体力:62
鱼:2条 | [(5, 4), (8, 9)]

移动199次后:
乌龟:(8, 7) | 体力:61
鱼:2条 | [(4, 4), (8, 10)]

移动200次后:
乌龟:(7, 7) | 体力:60
鱼:2条 | [(4, 5), (7, 10)]

移动201次后:
乌龟:(7, 6) | 体力:59
鱼:2条 | [(5, 5), (6, 10)]

移动202次后:
乌龟:(7, 7) | 体力:58
鱼:2条 | [(6, 5), (5, 10)]

移动203次后:
乌龟:(7, 9) | 体力:57
鱼:2条 | [(5, 5), (5, 9)]

移动204次后:
乌龟:(7, 7) | 体力:56
鱼:2条 | [(4, 5), (4, 9)]

移动205次后:
乌龟:(8, 7) | 体力:55
鱼:2条 | [(3, 5), (5, 9)]

移动206次后:
乌龟:(9, 7) | 体力:54
鱼:2条 | [(3, 6), (4, 9)]

移动207次后:
乌龟:(10, 7) | 体力:53
鱼:2条 | [(4, 6), (5, 9)]

移动208次后:
乌龟:(10, 9) | 体力:52
鱼:2条 | [(3, 6), (5, 8)]

移动209次后:
乌龟:(8, 9) | 体力:51
鱼:2条 | [(4, 6), (5, 7)]

移动210次后:
乌龟:(8, 7) | 体力:50
鱼:2条 | [(4, 5), (5, 8)]

移动211次后:
乌龟:(8, 9) | 体力:49
鱼:2条 | [(5, 5), (6, 8)]

移动212次后:
乌龟:(8, 8) | 体力:48
鱼:2条 | [(5, 6), (5, 8)]

移动213次后:
乌龟:(10, 8) | 体力:47
鱼:2条 | [(5, 7), (5, 7)]

移动214次后:
乌龟:(8, 8) | 体力:46
鱼:2条 | [(4, 7), (5, 8)]

移动215次后:
乌龟:(8, 7) | 体力:45
鱼:2条 | [(4, 8), (6, 8)]

移动216次后:
乌龟:(9, 7) | 体力:44
鱼:2条 | [(4, 7), (5, 8)]

移动217次后:
乌龟:(10, 7) | 体力:43
鱼:2条 | [(4, 6), (5, 9)]

移动218次后:
乌龟:(8, 7) | 体力:42
鱼:2条 | [(4, 7), (5, 10)]

移动219次后:
乌龟:(8, 5) | 体力:41
鱼:2条 | [(4, 8), (5, 9)]

移动220次后:
乌龟:(7, 5) | 体力:40
鱼:2条 | [(3, 8), (4, 9)]

移动221次后:
乌龟:(8, 5) | 体力:39
鱼:2条 | [(4, 8), (4, 8)]

移动222次后:
乌龟:(7, 5) | 体力:38
鱼:2条 | [(5, 8), (5, 8)]

移动223次后:
乌龟:(7, 3) | 体力:37
鱼:2条 | [(5, 9), (5, 9)]

移动224次后:
乌龟:(7, 1) | 体力:36
鱼:2条 | [(6, 9), (4, 9)]

移动225次后:
乌龟:(8, 1) | 体力:35
鱼:2条 | [(5, 9), (4, 10)]

移动226次后:
乌龟:(7, 1) | 体力:34
鱼:2条 | [(5, 8), (4, 9)]

移动227次后:
乌龟:(8, 1) | 体力:33
鱼:2条 | [(6, 8), (5, 9)]

移动228次后:
乌龟:(8, 0) | 体力:32
鱼:2条 | [(6, 9), (6, 9)]

移动229次后:
乌龟:(8, 1) | 体力:31
鱼:2条 | [(5, 9), (7, 9)]

移动230次后:
乌龟:(8, 3) | 体力:30
鱼:2条 | [(5, 10), (8, 9)]

移动231次后:
乌龟:(8, 4) | 体力:29
鱼:2条 | [(6, 10), (7, 9)]

移动232次后:
乌龟:(10, 4) | 体力:28
鱼:2条 | [(6, 9), (6, 9)]

移动233次后:
乌龟:(8, 4) | 体力:27
鱼:2条 | [(6, 10), (5, 9)]

移动234次后:
乌龟:(8, 3) | 体力:26
鱼:2条 | [(5, 10), (5, 8)]

移动235次后:
乌龟:(8, 5) | 体力:25
鱼:2条 | [(4, 10), (6, 8)]

移动236次后:
乌龟:(10, 5) | 体力:24
鱼:2条 | [(4, 9), (5, 8)]

移动237次后:
乌龟:(10, 3) | 体力:23
鱼:2条 | [(5, 9), (6, 8)]

移动238次后:
乌龟:(10, 1) | 体力:22
鱼:2条 | [(4, 9), (7, 8)]

移动239次后:
乌龟:(10, 0) | 体力:21
鱼:2条 | [(4, 10), (8, 8)]

移动240次后:
乌龟:(10, 2) | 体力:20
鱼:2条 | [(4, 9), (8, 9)]

移动241次后:
乌龟:(9, 2) | 体力:19
鱼:2条 | [(3, 9), (7, 9)]

移动242次后:
乌龟:(9, 4) | 体力:18
鱼:2条 | [(3, 10), (6, 9)]

移动243次后:
乌龟:(7, 4) | 体力:17
鱼:2条 | [(2, 10), (6, 10)]

移动244次后:
乌龟:(7, 2) | 体力:16
鱼:2条 | [(2, 9), (6, 9)]

移动245次后:
乌龟:(5, 2) | 体力:15
鱼:2条 | [(2, 10), (6, 8)]

移动246次后:
乌龟:(3, 2) | 体力:14
鱼:2条 | [(3, 10), (5, 8)]

移动247次后:
乌龟:(3, 4) | 体力:13
鱼:2条 | [(3, 9), (5, 9)]

移动248次后:
乌龟:(5, 4) | 体力:12
鱼:2条 | [(2, 9), (5, 10)]

移动249次后:
乌龟:(7, 4) | 体力:11
鱼:2条 | [(1, 9), (6, 10)]

移动250次后:
乌龟:(7, 6) | 体力:10
鱼:2条 | [(1, 10), (5, 10)]

移动251次后:
乌龟:(6, 6) | 体力:9
鱼:2条 | [(1, 9), (5, 9)]

移动252次后:
乌龟:(4, 6) | 体力:8
鱼:2条 | [(0, 9), (5, 8)]

移动253次后:
乌龟:(3, 6) | 体力:7
鱼:2条 | [(1, 9), (4, 8)]

移动254次后:
乌龟:(3, 8) | 体力:6
鱼:2条 | [(0, 9), (5, 8)]

移动255次后:
乌龟:(3, 9) | 体力:5
鱼:2条 | [(1, 9), (5, 7)]

移动256次后:
乌龟:(3, 7) | 体力:4
鱼:2条 | [(1, 8), (5, 8)]

移动257次后:
乌龟:(1, 7) | 体力:3
鱼:2条 | [(1, 9), (4, 8)]

移动258次后:
乌龟:(1, 5) | 体力:2
鱼:2条 | [(1, 10), (4, 9)]

移动259次后:
乌龟:(1, 3) | 体力:1
鱼:2条 | [(1, 9), (5, 9)]

移动260次后:
乌龟:(2, 3) | 体力:0
鱼:2条 | [(1, 8), (5, 8)]
乌龟的体力已耗尽,游戏结束!

小甲鱼303 发表于 2024-12-1 11:59:50

小甲鱼303 发表于 2024-12-3 20:51:29

页: [1]
查看完整版本: 乌龟吃鱼小游戏(旧版第037讲课后作业动动手第1题)