-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask-5-5.py
More file actions
51 lines (38 loc) · 1.25 KB
/
Task-5-5.py
File metadata and controls
51 lines (38 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# --coding:utf-8--
from robot import *
bIsCellPainted = False
bIsCellPaintedLeft = False
bIsCellPaintedRight = False
bIsCellPaintedUp = False
bIsCellPaintedDown = False
while not bIsCellPainted:
while is_free_up() and not bIsCellPainted:
bIsCellPainted = is_cell_painted()
if not bIsCellPainted:
move_up()
while is_free_down() and not bIsCellPainted:
bIsCellPainted = is_cell_painted()
if not bIsCellPainted:
move_down()
while is_free_left() and not bIsCellPainted:
bIsCellPainted = is_cell_painted()
if not bIsCellPainted:
move_left()
while is_free_right() and not bIsCellPainted:
bIsCellPainted = is_cell_painted()
if not bIsCellPainted:
move_right()
bIsCellPaintedLeft = bIsCellPainted and is_free_right()
bIsCellPaintedRight = bIsCellPainted and is_free_left()
bIsCellPaintedUp = bIsCellPainted and is_free_down()
bIsCellPaintedDown = bIsCellPainted and is_free_up()
if(bIsCellPaintedUp):
while is_free_down():
move_down()
while is_free_left():
move_left()
if(bIsCellPaintedLeft):
while is_free_right():
move_right()
while is_free_up():
move_up()