-
Notifications
You must be signed in to change notification settings - Fork 0
/
k.js
62 lines (54 loc) · 1.58 KB
/
k.js
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
class ComputerNumber {
#arr;
#playerIndex
#playerIndexConcat = 0;
#board = [[]];
constructor(arr, playerIndex, playerIndexConcat, board) {
this.#arr = arr;
this.#playerIndex = playerIndex;
this.#playerIndexConcat = playerIndexConcat ;
this.#board = board;
}
getNumber(){
console.log(
"player cliqued => " ,this.#playerIndex,
" concat => ", this.#playerIndexConcat,
" board=> ", this.#board,
" arr=> ", this.#arr);
// les diag valent 30 pts
let rdn =this.#arr[Math.floor(Math.random() * this.#arr.length)];
console.log("rdn ", rdn)
return rdn;
}
/*
max =0
choix = None
pour chaque coup de couleur
Gain = 0
Jouer ce coup
Memoriser le plateau
Repeter 1000 fois()
Finir la partie aleatoirement
Si couleur gagne
gain = gain +1
remettre le tableau memorisé
Si gain > max
max = gain
choix = coup
*/
async getZ(){
max = 0;
choix = 0;
for (let lin = 0; lin < this.#board.length; lin++) {
for (let col = 0; col < this.#board[lin].length; col++) {
const element = this.#board[lin][col];
if (element == 0) {
gain = 0
cpBoard = this.#board;
for(let i = 0; i<=1000;i++){
}
}
}
}
}
}