Example #1
0
        private void InitializeTrustExchangeTask()
        {
            List <TrustExchangeTask.Round> rounds = new List <TrustExchangeTask.Round>(TrustExchangeTaskRoundcount);

            TrustExchangeTask = new TrustExchangeTask(rounds);

            while (rounds.Count < TrustExchangeTaskRoundcount)
            {
                Persona roundPersonaCandidate = Personas[new Random().Next(0, Personas.Count - 1)];
                if (!rounds.Select(r => r.Persona).Cast <Persona>().ToList().Contains(roundPersonaCandidate))
                {
                    rounds.Add(
                        new TrustExchangeTask.Round(
                            roundPersonaCandidate,
                            () =>
                    {
                        PersonaClassification[] options =
                            new PersonaClassification[] { PersonaClassifications.COOPERATOR, PersonaClassifications.DEFECTOR };

                        return
                        (options[new Random().Next(0, options.Count())]);
                    }
                            )
                        );
                }
            }
        }
Example #2
0
        private void InitializeTrustExchangeTask()
        {
            List<TrustExchangeTask.Round> rounds = new List<TrustExchangeTask.Round>(TrustExchangeTaskRoundcount);

            TrustExchangeTask = new TrustExchangeTask(rounds);

            while (rounds.Count < TrustExchangeTaskRoundcount)
            {
                Persona roundPersonaCandidate = Personas[new Random().Next(0, Personas.Count - 1)];
                if (!rounds.Select(r => r.Persona).Cast<Persona>().ToList().Contains(roundPersonaCandidate))
                {
                    rounds.Add(
                        new TrustExchangeTask.Round(
                            roundPersonaCandidate,
                            () =>
                            {
                                PersonaClassification[] options =
                                    new PersonaClassification[] { PersonaClassifications.COOPERATOR, PersonaClassifications.DEFECTOR };

                                return
                                    options[new Random().Next(0, options.Count())];
                            }
                        )
                    );
                }
            }
        }