Ejemplo n.º 1
0
        /// <summary>
        /// Checks whether the runner has already finished the race by checking if he's in the list of winning racers.
        /// </summary>
        /// <param name="runner"></param>
        /// <returns></returns>
        public static bool CheckFinishedRace(Runner runner)
        {
            if (WinningRunners.Contains(runner.ID))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method checks if the runner finished the race. It checks the count of his RunnerLaps values and compares it to the number of necessary laps to end race.
        /// </summary>
        /// <param name="runner"></param>
        /// <returns></returns>
        public static bool CheckIsDone(Runner runner)
        {
            if (RunnerLaps[runner.ID].Count == NumOfLaps + 1)
            {
                WinningRunners.Add(runner.ID);
                return(true);
            }

            return(false);
        }