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)
     
    本攻略发于极客战记官方教学栏目,原文地址为:
  • 相关阅读:
    python 小爬虫
    动态规划,网易秋招
    leetcode 3
    leetcode 27 水
    leetcode 21 list merge
    leetcode 15 3sum & leetcode 18 4sum
    leetcode 389 map iterator 的使用
    [转]使用flask实现mock server
    python __str__repr__ 区别
    Robot Framework 源码阅读 day2 TestSuitBuilder
  • 原文地址:https://www.cnblogs.com/codecombat/p/13201423.html
Copyright © 2011-2022 走看看