-
Notifications
You must be signed in to change notification settings - Fork 0
/
RessourceBoard.txt
39 lines (29 loc) · 1.34 KB
/
RessourceBoard.txt
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
[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,1,0,0],[0,0,0,2,2,2,0],[0,0,0,1,2,1,0],[0,1,2,2,1,1,2]]
[[0,0,0,0,0,0,0],
[0,0,0,0,0,0,0],
[0,0,0,0,1,0,0],
[0,0,0,2,2,2,0],
[0,0,0,1,2,1,0],
[0,1,2,2,1,1,2]]
countRow(Row,PosX,CurrentX,Score,Player)
%Pour une liste L, et une position PosX dans cette liste, renvoie le nombre d'element Player dans les 3 elements avant et apres la position
countLineScore(L,PosX,Score,Player):-length(L,Taille),countLineScore(L,PosX,1,Score,Player,Taille).
countLineScore(_,_,CurrentX,0,_,Taille):-CurrentX is Taille+1.
countLineScore(_,PosX,CurrentX,0,_,_):- CurrentX is PosX+4.
countLineScore([F|R],PosX,CurrentX,Score,Player,Taille):- PosX-CurrentX<4, F==Player, is(NextX, CurrentX+1), countLineScore(R,PosX,NextX,NextScore,Player,Taille), is(Score, NextScore+1).
countLineScore([_|R],PosX,CurrentX,Score,Player,Taille):- is(NextX, CurrentX+1),countLineScore(R,PosX,NextX,Score,Player,Taille).
%I est la position dans la diagonale basse ou se trouve la position X Y
posDiagBas(X,Y,I):-I is min(X,Y).
[[3,4,5,7,5,4,3],
[4,6,8,10,8,6,4],
[5,8,11,13,11,8,5],
[5,8,11,13,11,8,5],
[4,6,8,10,8,6,4],
[3,4,5,7,5,4,3]]
[[3,4,5,7,5,4,3],[4,6,8,10,8,6,4],[5,8,11,13,11,8,5],[5,8,11,13,11,8,5],[4,6,8,10,8,6,4],[3,4,5,7,5,4,3]]
[[0,0,0,0,2,0,0],
[0,0,0,0,2,0,0],
[0,0,0,0,1,0,0],
[0,0,0,2,2,2,0],
[1,0,1,1,2,1,0],
[1,1,2,2,1,1,2]]