Exemple #1
0
        public static void Race(object _info)
        {
            lock (locker)
            {
                ThreadType info = (ThreadType)_info;

                if (info.Car.TimeInRace < 4)
                {
                    info.Car.AccSpeed();
                }
                else
                {
                    info.Car.ChangingSpeed();
                }

                info.Distance = info.Distance - info.Car.Speed;
                info.Car.TimeInRace++;

                if (info.Distance > 0)
                {
                    PrintRaceInfo.PrintingTeamRaceInfo(info.Car, Math.Round(info.Distance, 2));
                }
                else
                {
                    PrintRaceInfo.PrintingTeamRaceInfo(info.Car, 0);
                }
            }
        }
Exemple #2
0
        public static ThreadType FindMin(List <ThreadType> list)
        {
            ThreadType temp = list[0];

            foreach (var element in list)
            {
                if (element.Distance < temp.Distance)
                {
                    temp = element;
                }
            }

            return(temp);
        }