I am building a little game - rock paper scissors.
I have a prototype - RPSPlayer , and I have two types of players: Player1 , Player2 (player1 and player2 are objects with an RPSPlayer prototype), each player plays with a function: Player1.play() .
Each player has a different strategy for the game. So I need 2 implementations for play() . If it were Java, I would create an abstract RPSPlayer class with an abstract play() method and two other classes that inherit from RPSPlayer ; each of them will have its own implementation for play() .
My question is: what is the right way to do this in JS? I hope I made it clear, thanks to everyone.
source share