Exemple #1
0
        private clsChallengeGame GetNextMatch(List <clsMeetingAttendee> listRemainingAttendees)
        {
            clsChallengeGame nextGame = new clsChallengeGame();

            nextGame.GameBoard  = gameBoard;
            nextGame.GameDate   = DateTime.Today;
            nextGame.GameResult = "None";

            clsMeetingAttendee whitePlayer = GetWhitePlayer(listRemainingAttendees);

            nextGame.WhitePlayerID            = whitePlayer.Player.PlayerID;
            whitePlayer.ChallengeGameAssigned = true;
            listRemainingAttendees.Remove(whitePlayer);
            clsMeetingAttendee blackPlayer = GetBlackPlayer(whitePlayer, listRemainingAttendees);

            nextGame.BlackPlayerID            = blackPlayer.Player.PlayerID;
            blackPlayer.ChallengeGameAssigned = true;
            listRemainingAttendees.Remove(blackPlayer);
            return(nextGame);
        }
Exemple #2
0
        private clsMeetingAttendee GetBlackPlayer(clsMeetingAttendee whitePlayer, List <clsMeetingAttendee> listRemainingAttendees)
        {
            clsMeetingAttendee blackPlayer;

            int n = listRemainingAttendees.Count;

            if (n >= 5)
            {
                n = listRemainingAttendees.Count - 5;
            }
            else
            {
                n = 0;
            }
            for (int x = n; x <= listRemainingAttendees.Count - 1; x++)
            {
                blackPlayer = listRemainingAttendees.ElementAt(x);
                if ((blackPlayer.LastGame != null) && (blackPlayer.LastGame.WhitePlayerID == blackPlayer.Player.PlayerID) &&
                    (blackPlayer.LastGame.BlackPlayerID != whitePlayer.Player.PlayerID))
                {
                    return(blackPlayer);
                }
            }
            for (int x = n; x <= listRemainingAttendees.Count - 1; x++)
            {
                blackPlayer = listRemainingAttendees.ElementAt(x);
                if ((blackPlayer.LastGame != null) && ((blackPlayer.LastGame.WhitePlayerID ==
                                                        blackPlayer.Player.PlayerID) || (blackPlayer.LastGame.BlackPlayerID != whitePlayer.Player.PlayerID)))
                {
                    return(blackPlayer);
                }
            }


            blackPlayer = listRemainingAttendees.ElementAt(n);
            return(blackPlayer);
        }
Exemple #3
0
        private clsMeetingAttendee GetWhitePlayer(List <clsMeetingAttendee> listRemainingAttendees)
        {
            clsMeetingAttendee whitePlayer = listRemainingAttendees.Last();

            return(whitePlayer);
        }