Ejemplo n.º 1
0
        public override string ToString()
        {
            var matchScores       = string.Join(",", MatchScores.Select(s => s.ToString()).ToArray());
            var competitorsString = string.Join(",", PreviousCombatants.Where(s => !string.IsNullOrEmpty(s)).ToArray());
            var strings           = new List <string>
            {
                Genome,
                Score.ToString(),
                MatchesPlayed.ToString(),
                MatchesSurvived.ToString(),
                KilledAllDrones.ToString(),
                TotalDroneKills.ToString(),
                matchScores,
                competitorsString
            };

            return(string.Join(";", strings.ToArray()));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Records a match for this individual by adding data to that individual.
        /// </summary>
        /// <param name="finalScore">Score to add to the combatant</param>
        /// <param name="survived">True if this individual was alive at the end of the match</param>
        /// <param name="killedAllDrones">True if all the drones were killed in this match</param>
        /// <param name="dronesKilledThisMatch">The number of drones killed in this match</param>
        /// <param name="allCompetitors">All the individuals' genomes in the match</param>
        /// <param name="lastSurvivor">True if this one survived and no others did</param>
        public void RecordMatch(float finalScore, bool survived, bool killedAllDrones, int dronesKilledThisMatch, List <string> allCompetitors, bool lastSurvivor)
        {
            PreviousCombatants.AddRange(allCompetitors.Where(g => !string.IsNullOrEmpty(g) && g != Genome));

            Score += finalScore;

            TotalDroneKills += dronesKilledThisMatch;
            MatchesPlayed++;
            if (survived)
            {
                MatchesSurvived++;
            }
            if (lastSurvivor)
            {
                MatchesAsLastSurvivor++;
            }
            if (killedAllDrones)
            {
                KilledAllDrones++;
            }
            MatchScores.Add(finalScore);
        }