From 9e542c64ba70e16bb7ff332e7c18d3f65ade1a8a Mon Sep 17 00:00:00 2001 From: OezmenK Date: Tue, 19 Jul 2022 14:54:29 +0200 Subject: [PATCH] added train buttons --- src/app/board/board.component.html | 3 +++ src/app/board/board.component.ts | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/app/board/board.component.html b/src/app/board/board.component.html index 569890a..11895d3 100644 --- a/src/app/board/board.component.html +++ b/src/app/board/board.component.html @@ -3,6 +3,8 @@


+


+


current player: {{ player }}

Gewinner: {{ winner }}


@@ -10,3 +12,4 @@ + diff --git a/src/app/board/board.component.ts b/src/app/board/board.component.ts index 51ca2bb..1104a7f 100644 --- a/src/app/board/board.component.ts +++ b/src/app/board/board.component.ts @@ -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; }