Exemplo n.º 1
0
        public void GiveTimeDifference(List <IParticipant> participants, LinkedList <Driver> eindstand)
        {
            List <IParticipant> eindstandlist = new List <IParticipant>(); //turn LinkedList into a List in order to make it accesible by index

            foreach (Driver driver in eindstand)
            {
                eindstandlist.Add(driver);
            }

            for (int i = 0; i < eindstandlist.Count; i++)
            {
                DriverTimeDifference tmdffdriver = new DriverTimeDifference();
                tmdffdriver.Name = eindstandlist[i].Name;
                if (i == 0)
                {
                    tmdffdriver.TimeDifference = eindstandlist[i + 1].LapTime - eindstandlist[i].LapTime; //time difference between the front runner and the 2nd up
                }
                else
                {
                    tmdffdriver.TimeDifference = eindstandlist[i].LapTime - eindstandlist[0].LapTime; //time difference with the front runner
                }
                DriverTimeDifference.AddItemToList(tmdffdriver);
            }


            //eerste
            //wat is je tijdsverschil met de tweede,
            //geef

            //tweede,
            //wat is je tijdsverschil met de eerste
            //geef

            //enz
        }
Exemplo n.º 2
0
        public string GetBestDriverName(List <IDataTemplate> list)
        {
            DriverTimeDifference best = new DriverTimeDifference();

            foreach (DriverTimeDifference driver in list) //not correct
            {
                if (best.TimeDifference < driver.TimeDifference)
                {
                    best.TimeDifference = driver.TimeDifference;
                }
            }
            return(best.Name);
        }