예제 #1
0
        public string AddAction(string playerId, List <int> actions)
        {
            Player player = CurrentPlayers.FirstOrDefault(p => p.PlayerId.Equals(playerId));
            string result;

            if (player != null)
            {
                if (!player.ActionRecorded)
                {
                    player.ActionList = actions;
                    PlayersResponseCounter++;
                    result = $"Player action added, {CurrentPlayers.Count}/{MaxPlayers}";

                    if (PlayersResponseCounter >= CurrentPlayers.Count)
                    {
                        result = MakeMove();
                    }
                }
                else
                {
                    result = "Player action add failed, action already added";
                }
            }
            else
            {
                result = "Player action add failed, player not found";
            }

            return(result);
        }