public BettingPlan PlaceBet(MatchStartEventArgs matchArgs)
        {
            string betSymbol;

            var betSalt      = BaseBetAmount(matchArgs.Salt, matchArgs.TournamentPlayersRemaining);
            var betCharacter = SaltyConsole.Players.Unknown;

            var bluePlayer = _forbiddingManse.GetOrCreateCharacter(matchArgs.BluePlayer);
            var redPlayer  = _forbiddingManse.GetOrCreateCharacter(matchArgs.RedPlayer);

            if (redPlayer.IsReliableData && bluePlayer.IsReliableData)
            {
                //Ideal case, we have reliable information on both characters
                if (redPlayer.WinPercent > bluePlayer.WinPercent)
                {
                    betCharacter = SaltyConsole.Players.RedPlayer;
                }
                else
                {
                    betCharacter = SaltyConsole.Players.BluePlayer;
                }

                betSymbol = "=";

                Log.Verbose("Better - Winrate Tournament: {RedPlayer} Winrate {RedWinrate}%. {BluePlayer} Winrate {BlueWinrate}%.",
                            redPlayer.Name,
                            redPlayer.WinPercent,
                            bluePlayer.Name,
                            bluePlayer.WinPercent);
            }
            else if (redPlayer.IsReliableData)
            {
                if (redPlayer.WinPercent > 50)
                {
                    betCharacter = SaltyConsole.Players.RedPlayer;
                }
                else
                {
                    betCharacter = SaltyConsole.Players.BluePlayer;
                }

                betSymbol = "-";

                Log.Verbose("Better - Winrate Tournament: {RedPlayer} Winrate {RedWinrate}. {BluePlayer} Winrate is unreliable.",
                            redPlayer.Name,
                            redPlayer.WinPercent,
                            bluePlayer.Name);
            }
            else if (bluePlayer.IsReliableData)
            {
                if (bluePlayer.WinPercent > 50)
                {
                    betCharacter = SaltyConsole.Players.BluePlayer;
                }
                else
                {
                    betCharacter = SaltyConsole.Players.RedPlayer;
                }

                betSymbol = "-";

                Log.Verbose("Better - Winrate Tournament: {RedPlayer} Winrate is unreliable. {Blueplayer} Winrate is {BlueWinrate}.",
                            redPlayer.Name,
                            bluePlayer.Name,
                            bluePlayer.WinPercent);
            }
            else
            {
                betSymbol    = "~";
                betCharacter = SaltyConsole.Players.RedPlayer;
                if (IsHeads())
                {
                    betCharacter = SaltyConsole.Players.BluePlayer;
                }

                Log.Verbose("Better - Winrate Tournament: No reliable stats on either character. Randomly picked {player}.",
                            betCharacter.ToString());
            }

            return(new BettingPlan
            {
                Symbol = betSymbol,
                Character = betCharacter,
                Salt = betSalt
            });
        }
Example #2
0
        public BettingPlan PlaceBet(MatchStartEventArgs matchArgs)
        {
            var betSymbol = " ";

            var betSalt      = BaseBetAmount(matchArgs.Salt);
            var betCharacter = SaltyConsole.Players.Unknown;

            var bluePlayer = _forbiddingManse.GetOrCreateCharacter(matchArgs.BluePlayer);
            var redPlayer  = _forbiddingManse.GetOrCreateCharacter(matchArgs.RedPlayer);

            if (redPlayer.IsReliableData && bluePlayer.IsReliableData)
            {
                //Ideal case, we have reliable information on both characters
                if (redPlayer.WinPercent > bluePlayer.WinPercent)
                {
                    betCharacter = SaltyConsole.Players.RedPlayer;
                    betSalt     += AdditionalBetAmount(redPlayer, betSalt);
                }
                else
                {
                    betCharacter = SaltyConsole.Players.BluePlayer;
                    betSalt     += AdditionalBetAmount(bluePlayer, betSalt);
                }

                betSymbol = "=";

                Log.Verbose("Better - Winrate: {RedPlayer} Winrate {RedWinrate}%. {BluePlayer} Winrate {BlueWinrate}%.",
                            redPlayer.Name,
                            redPlayer.WinPercent,
                            bluePlayer.Name,
                            bluePlayer.WinPercent);
            }
            else if (redPlayer.IsReliableData)
            {
                if (redPlayer.WinPercent > 50)
                {
                    betCharacter = SaltyConsole.Players.RedPlayer;
                    betSalt     += AdditionalBetAmount(redPlayer, betSalt);
                }
                else
                {
                    betCharacter = SaltyConsole.Players.BluePlayer;
                }

                betSymbol = "-";

                Log.Verbose("Better - Winrate: {RedPlayer} Winrate {RedWinrate}. {BluePlayer} Winrate is unreliable.",
                            redPlayer.Name,
                            redPlayer.WinPercent,
                            bluePlayer.Name);
            }
            else if (bluePlayer.IsReliableData)
            {
                if (bluePlayer.WinPercent > 50)
                {
                    betCharacter = SaltyConsole.Players.BluePlayer;
                    betSalt     += AdditionalBetAmount(bluePlayer, betSalt);
                }
                else
                {
                    betCharacter = SaltyConsole.Players.RedPlayer;
                }

                betSymbol = "-";

                Log.Verbose("Better - Winrate: {RedPlayer} Winrate is unreliable. {Blueplayer} Winrate is {BlueWinrate}.",
                            redPlayer.Name,
                            bluePlayer.Name,
                            bluePlayer.WinPercent);
            }

            return(new BettingPlan
            {
                Symbol = betSymbol,
                Character = betCharacter,
                Salt = betSalt
            });
        }
        public BettingPlan PlaceBet(MatchStartEventArgs matchArgs)
        {
            var betSymbol = " ";

            var betSalt      = 10;
            var betCharacter = SaltyConsole.Players.Unknown;

            var bluePlayer = _forbiddingManse.GetOrCreateCharacter(matchArgs.BluePlayer);
            var redPlayer  = _forbiddingManse.GetOrCreateCharacter(matchArgs.RedPlayer);

            var(bluePlayerProfit, bluePlayerMatchcount) = GetProfitAndMatchcount(bluePlayer);
            var(redPlayerProfit, redPlayerMatchcount)   = GetProfitAndMatchcount(redPlayer);

            if (redPlayerProfit.Equals(bluePlayerProfit))
            {
                //Either identical profit expectations or more likely two characters without recorded matches
                return(new BettingPlan
                {
                    Symbol = betSymbol,
                    Character = SaltyConsole.Players.Unknown,
                    Salt = betSalt
                });
            }

            if (bluePlayerProfit != 0 && redPlayerProfit != 0)
            {
                betSymbol = "=";
            }
            else if (bluePlayerProfit != 0 || redPlayerProfit != 0)
            {
                betSymbol = "-";
            }

            if (redPlayerProfit > bluePlayerProfit)
            {
                betCharacter = SaltyConsole.Players.RedPlayer;
                betSalt      = BaseBetAmount(redPlayerProfit, matchArgs.Salt);

                if (redPlayerMatchcount > _reliableMatchCount && bluePlayerMatchcount > _reliableMatchCount)
                {
                    betSalt += AdditionalBetAmount(redPlayerProfit, betSalt);
                }

                Log.Verbose("Better - Profit: {RedPlayer} odds {RedPlayerCertainty}{RedPlayerProfit:N4} >>> {Blueplayer} odds {BluePlayerCertainty}{BluePlayerProfit:N4}.",
                            redPlayer.Name,
                            redPlayerMatchcount <= _reliableMatchCount ? "~" : "",
                            redPlayerProfit,
                            bluePlayer.Name,
                            bluePlayerMatchcount <= _reliableMatchCount ? "~" : "",
                            bluePlayerProfit);
            }
            else
            {
                betCharacter = SaltyConsole.Players.BluePlayer;
                betSalt      = BaseBetAmount(bluePlayerProfit, matchArgs.Salt);

                if (redPlayerMatchcount > _reliableMatchCount && bluePlayerMatchcount > _reliableMatchCount)
                {
                    betSalt += AdditionalBetAmount(bluePlayerProfit, betSalt);
                }

                Log.Verbose("Better - Profit: {RedPlayer} odds {RedPlayerCertainty}{RedPlayerProfit:N4} <<< {Blueplayer} odds {BluePlayerCertainty}{BluePlayerProfit:N4}.",
                            redPlayer.Name,
                            redPlayerMatchcount <= _reliableMatchCount ? "~" : "",
                            redPlayerProfit,
                            bluePlayer.Name,
                            bluePlayerMatchcount <= _reliableMatchCount ? "~" : "",
                            bluePlayerProfit);
            }

            return(new BettingPlan
            {
                Symbol = betSymbol,
                Character = betCharacter,
                Salt = betSalt
            });
        }