cp2025 計算機程式

  • Home
    • SMap
    • reveal
    • blog
  • About
    • cs101
    • Computer
      • llama
      • nginx
    • AI
      • QandA
      • Teams
    • Homework
  • Topics
    • Git
      • Git_ex1
      • Git_ex2
    • Python
      • SE
      • CL
      • Loops
      • Recursion
      • SA
      • SST
      • Maze
      • Collect
      • GT
      • Python_ex1
    • Javascript
      • HTML and CSS
    • Project
      • Waitress
      • API
  • Brython
    • Brython_ex
    • Robot_ex
  • Ref
    • Reeborg
      • ex1
      • Otto_ninja
    • tkinter
    • Pyodide
    • Pyodide_ex
    • Pyodide2
      • robot.py
      • Example2
    • Pyodide3
      • png_files
      • Harvest
SA << Previous Next >> Maze

SST

模擬與狀態追蹤(Simulation & State Tracking)
追蹤機器人狀態或環境變化。

# 範例 1:記錄走過的格子數
steps = 0
while not wall_in_front():
    move()
    steps += 1

# 範例 2:模擬方向轉動
def turn_right():
    for _ in range(3):
        turn_left()

# 範例 3:模擬狀態機(簡化)
state = "searching"
while state != "done":
    if object_here():
        take()
        state = "done"
    else:
        move()

SA << Previous Next >> Maze

Copyright © All rights reserved | This template is made with by Colorlib