learn from multiple games with fresh model each

This commit is contained in:
2022-07-29 05:35:58 +00:00
parent 539b3c02f5
commit f71602f385
2 changed files with 6 additions and 4 deletions

View File

@@ -115,7 +115,7 @@ constructModel() {
}; };
async trainOnGames(games, setState) { async trainOnGames(games, setState) {
const model = this.getModel(); const model = this.constructModel();
// model.dispose(); // model.dispose();
let AllX = []; let AllX = [];
let AllY = []; let AllY = [];

View File

@@ -18,6 +18,8 @@ export class BoardComponent implements OnInit {
history: any[]; history: any[];
ai = new AiService(); ai = new AiService();
games = [];
constructor() {} constructor() {}
ngOnInit(): void { ngOnInit(): void {
@@ -62,9 +64,9 @@ export class BoardComponent implements OnInit {
}); });
}); });
// const ai = new AiService(); // const ai = new AiService();
const games = [];
games.push(this.ai.getMoves(AllMoves)); this.games.push(this.ai.getMoves(AllMoves));
this.ai.trainOnGames(games, (data)=>{ console.log(data); }); this.ai.trainOnGames(this.games, (data)=>{ console.log(data); });
} }
resetGame() { resetGame() {