override fallbackFn()

in src/app/pages/game/services/ai-strategies/conditional-strategy.service.ts [40:60]


  override fallbackFn(): Signs {
    // This strategy is called "win-stay, lose-shift"
    // If a player wins once, it's likely that they'll repeat the same action as before
    if (
      this.gameHandler.playerLosingStreak() == 0 &&
      this.gameHandler.pastPlayerMoves().length > 0
    ) {
      return this.getWinningSign(
        this.gameHandler.pastPlayerMoves()[this.gameHandler.pastPlayerMoves().length - 1].name,
      );
    }
    // If a player has lost two or more times, they're most likely to shift to the play that would have beaten what they just lost to
    else if (
      this.gameHandler.playerLosingStreak() > 1 &&
      this.gameHandler.pastPlayerMoves().length > 0
    ) {
      return this.gameHandler.pastPlayerMoves()[this.gameHandler.pastPlayerMoves().length - 1].name;
    } else {
      return this.getRandomSign();
    }
  }