-
Notifications
You must be signed in to change notification settings - Fork 1
/
moves.pl
107 lines (92 loc) · 8.91 KB
/
moves.pl
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
rook(X1,Y1,D,X2,MT,L):-X2 is X1,Y2 is Y1+1,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-1,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+1,Y2 is Y1+1,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-1,Y2 is Y1+1,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+1,Y2 is Y1-1,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-1,Y2 is Y1-1,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,MT,L):-X2 is X1,Y2 is Y1+2,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-2,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+2,Y2 is Y1+2,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-2,Y2 is Y1+2,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+2,Y2 is Y1-2,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-2,Y2 is Y1-2,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,MT,L):-X2 is X1,Y2 is Y1+3,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-3,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+3,Y2 is Y1+3,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-3,Y2 is Y1+3,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+3,Y2 is Y1-3,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-3,Y2 is Y1-3,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,MT,L):-X2 is X1,Y2 is Y1+4,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-4,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+4,Y2 is Y1+4,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-4,Y2 is Y1+4,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+4,Y2 is Y1-4,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-4,Y2 is Y1-4,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,MT,L):-X2 is X1,Y2 is Y1+5,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-5,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+5,Y2 is Y1+5,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-5,Y2 is Y1+5,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+5,Y2 is Y1-5,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-5,Y2 is Y1-5,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,MT,L):-X2 is X1,Y2 is Y1+6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+6,Y2 is Y1+6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-6,Y2 is Y1+6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+6,Y2 is Y1-6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-6,Y2 is Y1-6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,MT,L):-X2 is X1,Y2 is Y1+6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+6,Y2 is Y1+6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-6,Y2 is Y1+6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+6,Y2 is Y1-6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-6,Y2 is Y1-6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,MT,L):-X2 is X1,Y2 is Y1+7,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-7,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+1,Y2 is Y1+7,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-1,Y2 is Y1+7,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+1,Y2 is Y1-7,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-1,Y2 is Y1-7,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,MT,L):-X2 is X1,Y2 is Y1+8,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-8,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+8,Y2 is Y1+8,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-8,Y2 is Y1+8,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+8,Y2 is Y1-8,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-8,Y2 is Y1-8,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,MT,L):-X2 is X1,Y2 is Y1+9,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-9,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+9,Y2 is Y1+9,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-9,Y2 is Y1+9,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1+9,Y2 is Y1-9,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
rook(X1,Y1,D,X2,Y2,L):-X2 is X1-9,Y2 is Y1-9,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
%%%% ---
%bishop
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1+2,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-2,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1+1,Y2 is Y1+2,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1-1,Y2 is Y1+2,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1+1,Y2 is Y1-2,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1-1,Y2 is Y1-2,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1+4,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-4,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1+2,Y2 is Y1+4,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1-2,Y2 is Y1+4,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1+2,Y2 is Y1-4,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1-2,Y2 is Y1-4,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1+6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1+3,Y2 is Y1+6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1-3,Y2 is Y1+6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1+3,Y2 is Y1-6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1-3,Y2 is Y1-6,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1+8,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-8,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1+4,Y2 is Y1+8,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1-4,Y2 is Y1+8,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1+4,Y2 is Y1-8,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1-4,Y2 is Y1-8,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1+10,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1,Y2 is Y1-10,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1+5,Y2 is Y1+10,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1-5,Y2 is Y1+10,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1+5,Y2 is Y1-10,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).
bishop(X1,Y1,D,X2,Y2,L):-X2 is X1-5,Y2 is Y1-10,get(X2,Y2,P,D),(P =1;L is P//10),(X2 \== X1;Y2 \== Y1).