Lesson 4: Plan a route
이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
Plan a route
- Before you code, plan the path: how far to drive, which way to turn.
- Use the floor squares: each one is 250 mm. Four squares are 1000 mm.
- The robot must not touch the walls or the grey boxes. A red star shows where it crashed.
Words for this lesson
| Word | Meaning |
|---|---|
| route | the way the robot goes, step by step |
| checkpoint | a numbered circle the robot must drive over |
| obstacle | a wall or box in the way |
| crash | the robot hits a wall |
English
Count the squares
from vexcode_vr import *
def main():
drivetrain.drive_for(FORWARD, 750, MM) # 3 squares up
drivetrain.turn_for(LEFT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 500, MM) # 2 squares left
vr_thread(main)
- A
#starts a comment: a note for people. The robot ignores it.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
Drive over checkpoints 1, 2 and 3 in order, without touching the grey box. Checkpoint 1 is 1000 mm up, 2 is 1000 mm right of it, 3 is 800 mm below 2.
출력을 보려면 '실행'을 클릭하세요.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
A wall is between the robot and the goal. Go round its right end: turn right, drive 1250 mm, turn left, drive 1200 mm, turn left, drive 1250 mm.
출력을 보려면 '실행'을 클릭하세요.