zoukankan      html  css  js  c++  java
  • 「网易官方」极客战记(codecombat)攻略-沙漠-扫雷-minesweeper

    (点击图片进入关卡)

    当你应用地触发地雷的时候,让一帮不幸的农民在通过奸诈峡谷。

    简介

    清除盟友的道路!

    移动到每个硬币上,踩下可能在它们下面的任何地雷。

    如果你的生命值太低,向左移动 10 米,向医生说 "Heal please!" !

    默认代码

    # 让农民和他们的拯救者通过雷区。
    while True:
        coin = hero.findNearestItem()
        healingThreshold = hero.maxHealth / 2
        # 检查你是否受重伤。
        if hero.health < healingThreshold:
            # 向左移动10m.

     

            # 寻求治愈。
            hero.say("Can I get a heal?")
            pass
        # 否则,移动到下一个硬币。
        elif coin:
            hero.moveXY(coin.pos.x, coin.pos.y)

    概览

    用自己的身体引爆地雷! 农民会跟随你,但是如果你的生命值远远低于你的 maxHealth,你需要往回跑 10 米,让Beak 医生来医治

    要触发地雷,移动到最上面的硬币。 你可以使用 findNearestItem 方法知道去哪儿。

    扫雷 解法

    # 让农民和他们的拯救者通过雷区。
    while True:
        coin = hero.findNearestItem()
        healingThreshold = hero.maxHealth / 2
        # 检查你是否受重伤。
        if hero.health < healingThreshold:
            # 向左移动10m.
            x = hero.pos.x
            y = hero.pos.y
            hero.moveXY(x - 10, y)
            # 寻求治愈。
            hero.say("Can I get a heal?")
        # 否则,移动到下一个硬币。
        elif coin:
            hero.moveXY(coin.pos.x, coin.pos.y)
     
    本攻略发于极客战记官方教学栏目,原文地址为:
  • 相关阅读:
    常春藤之路,从幼儿园开始走起
    常青藤零距离
    web-service
    WebService到底是什么?
    How to add libraries to “External Libraries” in WebStorm/PhpStorm/Intellij
    浏览器核心说明
    万维网
    js和jquery获取span里面的值
    TPshop学习
    sphinx文档
  • 原文地址:https://www.cnblogs.com/codecombat/p/13201423.html
Copyright © 2011-2022 走看看