|
|
||
|---|---|---|
| .vscode | ||
| data | ||
| editor.html | ||
| editor.js | ||
| game.js | ||
| gameworld.js | ||
| index.html | ||
| old.html | ||
| pyodide-worker.js | ||
| readme.md | ||
| robot.js | ||
| sensor.js | ||
| style.css | ||
| todo.md | ||
readme.md
import robot import time
robot.move(0.00006) while True: if robot.get_sensors()[0]["hitpoint"]["x"] is not None: robot.turn(0.001) elif robot.get_sensors()[1]["hitpoint"]["x"] is not None: robot.turn(-0.001) else: robot.turn(0) time.sleep(0.1)
import robot import time
robot.move(0.00006) while True: left = robot.get_sensors()[0]["distance"] right = robot.get_sensors()[1]["distance"] print(str(int(left)) + "\t" + str(int(right))) if left < 55: robot.turn(0.01) elif right < 55: robot.turn(-0.01) else: robot.turn(0) time.sleep(0.1)
#Robot 1 import time import robot
robot.move(1) time.sleep(1.6) robot.move(0) robot.turn(1) time.sleep(2.2) robot.turn(0) robot.move(1)
#Robot 2 import robot import time
robot.move(1) time.sleep(0.8) robot.move(0.4) robot.turn(1) time.sleep(4.7) robot.move(0) robot.turn(0)
#Robot 3 import time import robot
robot.move(1) while True: if robot.get_distance_left() < 58: robot.turn(1) robot.move(0.2) elif robot.get_distance_right() < 58: robot.turn(-1) robot.move(0.2) else: robot.move(1) robot.turn(0) time.sleep(0.01)