14-3 謎めいた村③

解説動画

解答コード

player.onChat("14-3", function () {

    const air = 0;
    const plank = 1;
    const stair = 2;
    agent.move(UP, 2);
    agent.move(FORWARD, 3);
    const stairPlan = [
        [
            [plank, plank, plank],
            [stair, stair, stair]
        ],
        [
            [stair, stair, stair],
            [air, air, air]
        ],
    ];
    for (let y = 0; y < 2; y++) {
        for (let x = 0; x < 3; x++) {
            for (let z = 0; z < 2; z++) {
                if (stairPlan[y][z][x] == plank) {
                    agent.setSlot(1);
                    agent.place(FORWARD);
                }
                if (stairPlan[y][z][x] == stair) {
                    agent.setSlot(2);
                    agent.place(FORWARD);
                }
                agent.move(BACK, 1);
            }
            agent.move(RIGHT, 1);
            agent.move(FORWARD, 2);
        }
        agent.move(UP, 1);
        agent.move(LEFT, 3);
    }
});