アルゴリズムとは?(MakeCode用語集)
用語更新日:2026年11月13日
ひとことで言うと
問題を解くための、手順の決まりのことです。
アルゴリズムとは
問題を解くための、手順の決まりのことです。
もう少しくわしく
たとえば「前にブロックがあれば右を向き、なければ進む」は、迷路を進むためのアルゴリズムです。
例
player.onChat("maze", function () {
for (let i = 0; i < 50; i++) {
if (agent.detect(AgentDetection.Block, FORWARD)) {
agent.turn(TurnDirection.Right)
} else {
agent.move(FORWARD, 1)
}
}
})
def on_on_chat():
for i in range(50):
if agent.detect(AgentDetection.BLOCK, FORWARD):
agent.turn(TurnDirection.RIGHT)
else:
agent.move(FORWARD, 1)
player.on_chat("maze", on_on_chat)