-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmix5.pas
62 lines (62 loc) · 919 Bytes
/
mix5.pas
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
51
52
53
54
55
56
57
58
59
60
61
62
uses Robot;
procedure krest;
var n:integer;
b:integer;
begin
n:=0;
b:=0;
while FreeFromLeft do
begin
left;paint;
n:=n+1;
end;
for n:=1 to n do right;
n:=0;
while FreeFromRight do
begin
right;paint;
n:=n+1;
end;
for n:=1 to n do left;
while FreeFromUp do
begin
up;paint;
b:=b+1;
end;
for b:=1 to b do down;
b:=0;
while FreeFromDown do
begin
down;paint;
b:=b+1;
end;
for b:=1 to b do up;
end;
begin
Task('mix5');
while FreeFromDown do down;
while FreeFromLeft do left;
while CellIsFree and CellIsFree do
begin
while FreeFromRight and CellIsFree do
begin
if FreeFromRight then right;
if CellIsPainted then
begin
krest();
exit;
end;
end;
up;
while FreeFromLeft do
begin
if FreeFromLeft then left;
if CellIsPainted then
begin
krest();
exit;
end;
end;
up;
end;
end.