-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hanoi.htn
56 lines (46 loc) · 1.24 KB
/
Hanoi.htn
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
# 3 pegs, 3 slots each, each slot is an integer representing plate width
type Peg:
left
middle
right
task Main:
Init()
Hanoi()
task Hanoi(right.bottom == 3 & right.middle == 2 & right.top == 1):
complete()
task Init:
pass
effects:
left.bottom = 3
left.middle = 2
left.top = 1
task Pickup_top(carry==0 & peg.top > 0) for Peg as peg:
pickup(peg.top)
effects:
carry = peg.top
peg.top = 0
task Pickup_middle(carry==0 & peg.middle > 0 & peg.top == 0) for Peg as peg:
pickup(peg.middle)
effects:
carry = peg.middle
peg.middle = 0
task Pickup_bottom(carry==0 & peg.bottom > 0 & peg.middle == 0 & peg.top == 0) for Peg as peg:
pickup(peg.bottom)
effects:
carry = peg.bottom
peg.bottom = 0
task Dropoff_top(carry>0 & peg.top==0 & peg.middle > carry) for Peg as peg:
dropoff(peg.top, carry)
effects:
peg.top = carry
carry = 0
task Dropoff_middle(carry>0 & peg.middle==0 & peg.bottom > carry & peg.top == 0) for Peg as peg:
dropoff(peg.middle, carry)
effects:
peg.middle = carry
carry = 0
task Dropoff_bottom(carry>0 & peg.bottom==0 & peg.middle == 0 & peg.top == 0) for Peg as peg:
dropoff(peg.bottom, carry)
effects:
peg.bottom = carry
carry = 0