• 「网易官方」极客战记(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
     
    本攻略发于极客战记官方教学栏目,原文地址为:
     
  • 相关阅读:
    [BTS2004]一步一步学习BizTalk2004 Sql Server Adapter
    [JWT]安装配置AdobeWorkFlowServer
    [BizTalk][MSMQAdapter]如何使用MSMQ的优先级设置呢?
    [JWS]Adobe WorkFlow 学习笔记(二)
    [RS]消息订阅应用实例(一)
    [BizTalk][Pipeline]使用Pipeline(一)
    ActiveDirectoryLib
    [ASP.NET]10 Tips for Writing HighPerformance Web Applications
    [UML]始
    [学习笔记][C++Primer Plus]String类的使用
  • 原文地址:https://www.cnblogs.com/codecombat/p/13139569.html
Copyright © 2020-2023  润新知