-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTask12.jl
33 lines (30 loc) · 1.04 KB
/
Task12.jl
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
function mark_kross(r)
side_hor = West
side_vert = Nord
putmarkers!(r, side_hor, side_vert)
move_by_markers(r, inverse(side_hor), inverse(side_vert))
side_hor = inverse(side_hor)
putmarkers!(r, side_hor, side_vert)
move_by_markers(r, inverse(side_hor), inverse(side_vert))
side_vert = inverse(side_vert)
putmarkers!(r, side_hor, side_vert)
move_by_markers(r, inverse(side_hor), inverse(side_vert))
side_hor = inverse(side_hor)
putmarkers!(r, side_hor, side_vert)
move_by_markers(r, inverse(side_hor), inverse(side_vert))
putmarker!(r)
end
function putmarkers!(r::Robot, side_hor::HorizonSide, side_vert::HorizonSide)
while !isborder(r, side_hor) && !isborder(r, side_vert)
move!(r, side_hor);
move!(r, side_vert)
putmarker!(r)
end
end
function move_by_markers(r::Robot, side_hor::HorizonSide, side_vert::HorizonSide)
while ismarker(r)
move!(r, side_hor);
move!(r, side_vert)
end
end
inverse(side::HorizonSide) = HorizonSide(mod(Int(side) + 2, 4))