예제 #1
0
        public static bool IsFreeEvolSlot(string userName)
        {
            // If the user is already active, it will use its own allocated spot
            if (ActiveUsersList <NeatGenome> .ContainsUser(userName))
            {
                return(true);
            }
            // If not already active, it will need a new spot:
            ActiveUsersList <NeatGenome> .RemoveInactiveUsers();

            // This wait is probably innecessary, but there have been errors where new users try to
            // take the place of others, causing trouble.
            System.Threading.Thread.Sleep(100);
            if (ActiveUsersList <NeatGenome> .Count() >= ActiveUsersList <NeatGenome> .MaxNumberOfUsers)
            {
                WriteLineForDebug("Requested a slot but the server was full.", userName);
                return(false);
            }
            return(true);
        }