zoukankan      html  css  js  c++  java
  • 「网易官方」极客战记(codecombat)攻略-沙漠-猎人谷-hunter-valley

     

    (点击图片进入关卡)

    这是一个狩猎的好地方,但不是当你是诱饵的时候。

    简介

    你在错误的时间出现在错误的地方。 你需要在牦牛出现之前逃跑。

    利用从猎人和相对位置函数推出的路线离开这里。

    默认代码

    # 逃到山谷的右边

     

    # 该函数能使英雄向下向右移动。
    def moveDownRight(step):
        hero.moveXY(hero.pos.x + step, hero.pos.y - step)

     

    # 该函数能使英雄向上和向右移动。
    def moveUpRight(step):
        # 完成这个函数:

     

        pass

     

    # 猎人很善良,并会展示路线。
    hunter = hero.findFriends()[0]
    route = hunter.route
    routeIndex = 0

     

    while routeIndex < len(route):
        direction = route[routeIndex]
        if direction > 0:
            moveUpRight(8)
        else:
            # 使用带Shift 8的函数moveDownRight:

     

            pass
        routeIndex += 1

    概览

    你还记得《地牢》中的 moveLeft 这样的古老方法吗?在这个关卡,您将创建属于自己的灵活和完善的函数。

    使用'moveDownRight' 的示例代码来完成 moveUpRight 函数。

    猎人谷 解法

    # 逃到山谷的右边

     

    # 该函数能使英雄向下向右移动。
    def moveDownRight(step):
        hero.moveXY(hero.pos.x + step, hero.pos.y - step)

     

    # 该函数能使英雄向上和向右移动。
    def moveUpRight(step):
        # 完成这个函数:
        hero.moveXY(hero.pos.x + step, hero.pos.y + step)
        pass

     

    # 猎人很善良,并会展示路线。
    hunter = hero.findFriends()[0]
    route = hunter.route
    routeIndex = 0

     

    while routeIndex < len(route):
        direction = route[routeIndex]
        if direction > 0:
            moveUpRight(8)
        else:
            # 使用带Shift 8的函数moveDownRight:
            moveDownRight(8)
            pass
        routeIndex += 1
     
    本攻略发于极客战记官方教学栏目,原文地址为:
     
  • 相关阅读:
    Selenium中解决输入法导致sendKeys输入内容与预期不一致的问题
    java代码中启动exe程序最简单的方法
    安装node.js
    安装MongoDB流程。
    阿里云RocketMQ定时/延迟消息队列实现
    Camunda工作流引擎简单入门
    因是子静坐养生汇编PDF下载-蒋维乔
    倪海厦天纪系列之天机道
    倪海厦天纪系列之地脉道
    张志顺老道长八部金刚功长寿功PDF下载
  • 原文地址:https://www.cnblogs.com/codecombat/p/13139569.html
Copyright © 2011-2022 走看看