-
Notifications
You must be signed in to change notification settings - Fork 0
/
grilla.pl
42 lines (37 loc) · 2.18 KB
/
grilla.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
emptyBoard([
["-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","-","w","-","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","w","-","w","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","w","-","w","-","-","w","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","w","-","w","-","-","-","w","-","-","-","-","-","-","-","-","-"],
["-","-","-","-","w","-","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","-","-","b","-","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","w","b","-","b","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","w","-","b","-","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"],
["-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"]]).
%shell del getValue, devuelve en Colour la ficha buscada
getValueS(Board, [R, C], Color) :-
getValue(R, Board, Row),
getValue(C, Row, Color).
getValue(0, [X|_Xs], X).
getValue(XIndex, [_Xi|Xs], X):-
XIndex > 0,
XIndexS is XIndex - 1,
getValue(XIndexS, Xs, X).
getValuesOfPoints(_Board, [], []).
getValuesOfPoints(Board, [X | Xs], [N | Ns]) :- getValuesOfPoints(Board, Xs, Ns), getValueS(Board, X, N).
adjacent([R, C], [R, C1]) :- C < 18, C1 is (C + 1).
adjacent([R, C], [R, C1]) :- C > 0, C1 is (C - 1).
adjacent([R, C], [R1, C]) :- R < 18, R1 is (R + 1).
adjacent([R, C], [R1, C]) :- R > 0, R1 is (R - 1).
opuesto("b", "w").
opuesto("w", "b").