Example #1
0
 public void PlayerAvailableActionsChanged(string playerName, IList <PlayerAction> actions)
 {
     _pokoraDisplayer.UpdateDisplay();
 }
Example #2
0
        public async Task StartSoloGame()
        {
            _eventManager.EventReceived += _eventManager_EventReceived;

            try
            {
                double totalPaid = 0;
                double totalEarn = 0;
                var    wins      = new Dictionary <User, int>();
                var    users     = new List <User>
                {
                    new User(20)
                    {
                        Name       = "Tommy",
                        Controller = new ProbalisticController(Learner.Instance.GetJsonAreas(Ias.Pce30), true)
                    },
                    new User(20)
                    {
                        Name       = "Ratchet",
                        Controller = new ProbalisticController(Learner.Instance.GetJsonAreas(Ias.Pce13), true)
                    },
                    new User(20)
                    {
                        Name       = "Corail",
                        Controller = new ConsolePlayerController()
                    },
                };

                wins.Add(users[0], 0);
                wins.Add(users[1], 0);
                wins.Add(users[2], 0);

                _displayer.IsSoloGame = true;
                _displayer.SetupDisplay(users);

                var           spinAngGoCount = 0;
                SpinAndGoGame spinAndGoGame  = null;
                do
                {
                    spinAngGoCount++;

                    spinAndGoGame = new SpinAndGoGame(1, _consoleNotifier, spinAngGoCount);
                    _displayer.SetupGameDisplay(spinAndGoGame);
                    spinAndGoGame.Setup(users.ToList());


                    var winner = spinAndGoGame.LaunchAsync();
                    if (wins.ContainsKey(winner))
                    {
                        wins[winner]++;
                    }

                    winner.Earn(spinAndGoGame.Prize);

                    totalEarn += spinAndGoGame.Prize;
                    totalPaid += spinAndGoGame.Fee * 3;
                } while (users.All(user => user.Cash - spinAndGoGame.Fee >= 0));

                _displayer.UpdateDisplay();

                Console.WriteLine($"TotalPaid : {totalPaid}");
                Console.WriteLine($"TotalEarn : {totalEarn}");
                Console.WriteLine($"Rake : {totalEarn / totalPaid * 100} %");
                Console.WriteLine($": Winrates : {string.Join(" | ", wins.ToList().Select(kvp => $"{kvp.Key.Name}: {(double)kvp.Value / spinAngGoCount * 100}%"))}");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }