-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlevel1
22 lines (18 loc) · 848 Bytes
/
level1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
% Simple first level file
% (stupid game without strategy)
% Facts generated by software:
% enemy(I,J).
% computer(P,I,J).
% free(I,J).
% Guess
move(P, I, J) | notMove(P, I, J) :- canMove(P, I, J).
% Can move in one of four possible directions
canMove(P, I, J) :- canMoveInDirection1(P, I, J).
canMove(P, I, J) :- canMoveInDirection2(P, I, J).
canMove(P, I, J) :- canMoveInDirection3(P, I, J).
canMove(P, I, J) :- canMoveInDirection4(P, I, J).
canMoveInDirection1(P, I, J) :- computer(P, I1 , J1), free(I,J), I1=I+2, J1=J.
canMoveInDirection2(P, I, J) :- computer(P, I1 , J1), free(I,J), I1=I-2, J1=J.
canMoveInDirection3(P, I, J) :- computer(P, I1 , J1), free(I,J), I1=I, J1=J+2.
canMoveInDirection4(P, I, J) :- computer(P, I1 , J1), free(I,J), I1=I, J1=J-2.
canMoveInDirection4(P, I, J) :- computer(P, I1 , J1), free(I,J), I1=I, J1=J-3.