export default class GameModel { constructor() { this.choices = ["rock", "paper", "scissors"]; this.score = { player: 0, computer: 0}; } getComputerChoice() { const index = Math.floor(Math.random() * this.choices.length); return this.choices[index]; } getResult(player, computer) { if (player === computer) return "égalité"; if ( (player === "rock" && computer === "scissors") || (player === "paper" && computer === "rock") || (player === "scissors" && computer === "paper") ) { this.score.player++; return "gagné"; } this.score.computer++; return "perdu"; } getScore() { return this.score; } }