private double GetCurrentPositionScore(Pod creaturepod) { TransformedPodBrain pb = new TransformedPodBrain(); pb.SetConditions(creaturepod, _raceInfo, new[] { 2.342, 30.91, 0.02181 }); int finnisch = (_pod.NextCheckPointId + 2) % _raceInfo.CheckpointCount; double score = 0; while (creaturepod.NextCheckPointId != finnisch && score < 100) { pb.GetAction(); //creaturepod.SetAction(v, 100, false, false); creaturepod.Rotate(); creaturepod.Thrust(); creaturepod.Move(); if ((_raceInfo.Checkpoints[creaturepod.NextCheckPointId].Position - creaturepod.Position).Size < 600) { creaturepod.NextCheckPointId = (creaturepod.NextCheckPointId + 1) % _raceInfo.CheckpointCount; } score++; } return(score); }
public Race(RaceInfo raceInfo) { _raceInfo = raceInfo; int podCount = 2; _pods = new Pod[podCount]; for (int i = 0; i < podCount; i++) { _pods[i] = new Pod(); } _podBrains = new IPodBrain[podCount]; InitializePods(podCount); _podBrains[0] = new GeneticBrain(); _podBrains[0].SetConditions(_pods[0], _raceInfo, null); _podBrains[1] = new TransformedPodBrain(); _podBrains[1].SetConditions(_pods[1], _raceInfo, new[] { 2.342, 30.91, 0.02181 }); // _podBrains[1] = new SimpleSeekPodBrain(_pods[1], _raceInfo, new[] { 2.5 }); // _podBrains[2] = new SimpleSeekPodBrain(_pods[2], _raceInfo, new[] { 3.0 }); // _podBrains[3] = new SimpleSeekPodBrain(_pods[3], _raceInfo, new[] { 4.0 }); }