added train buttons
This commit is contained in:
@@ -21,6 +21,29 @@ export class BoardComponent implements OnInit {
|
||||
this.resetGame();
|
||||
}
|
||||
|
||||
trainUp(playerLearn) {
|
||||
console.log('Train Called - to be more like ', playerLearn);
|
||||
|
||||
const AllMoves = this.history.map((board) => {
|
||||
return board.map((v) => {
|
||||
if (v === playerLearn) {
|
||||
return 1;
|
||||
} else if (v === null) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
});
|
||||
console.log(AllMoves);
|
||||
// let ai: AiService;
|
||||
// let games = [];
|
||||
// games.push(AllMoves);
|
||||
// ai = new AiService();
|
||||
// ai.trainOnGames(games, (data)=>{console.log(data)});
|
||||
|
||||
}
|
||||
|
||||
resetGame() {
|
||||
this.winner = null;
|
||||
this.draw = false;
|
||||
@@ -34,7 +57,7 @@ export class BoardComponent implements OnInit {
|
||||
}
|
||||
|
||||
playerPress(i: number) {
|
||||
if(this.winner != null) {
|
||||
if (this.winner != null) {
|
||||
this.resetGame();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user