13-4 白くしずかな村④

解説動画

解答コード

function cloneLine13_4() {
    arr.forEach(function (element) {
        agent.setItem(element, 1, 1);
        agent.place(FORWARD);
        agent.move(RIGHT, 1);
    });
}

player.onChat("13-4", function () {

    arr = [];
    agent.move(UP, 1);

    // 11ブロック読み込む
    for (let i = 0; i < 11; i++) {
        // 前にあるブロックがどんなブロックか(たとえば、石や木など)を調べる
        let block_type = agent.inspect(AgentInspection.Block, FORWARD);
        // 調べたブロックのデータを配列に入れる
        arr.push(block_type);
        // エージェントが右に1ブロック進む
        agent.move(RIGHT, 1);
    }

    agent.move(LEFT, 11);
    agent.move(UP, 1);

    cloneLine13_4();
});

補足

  • 墓地でシルクハットを回収すると13-5への道の封鎖が解かれます。