public World(INetwork network) : base(0, 0, 1000, 1000) { color = System.Drawing.Brushes.White; bigBrain = (FloatFastConcurrentNetwork)network; size = height; }
public World(INetwork network) : this() { if (network != null) { bigBrain = (FloatFastConcurrentNetwork)network; } }
public Predator(float x, float y, float w, float h, INetwork network) : base(x, y, w, h, network) { radius = 200; sensors = new float[5]; angledelta = (float)Math.PI / sensors.Length; halfangledelta = angledelta / 2.0f; brain = (FloatFastConcurrentNetwork)network; }
public static void Write(XmlNode parentNode, FloatFastConcurrentNetwork network, IActivationFunction activationFn) { //----- Start writing. Create document root node. XmlElement xmlNetwork = XmlUtilities.AddElement(parentNode, "network"); XmlUtilities.AddAttribute(xmlNetwork, "activation-fn-id", activationFn.FunctionId); //----- Write Connections. XmlElement xmlConnections = XmlUtilities.AddElement(xmlNetwork, "connections"); foreach (FloatFastConnection connectionGene in network.connectionArray) { WriteConnection(xmlConnections, connectionGene); } }
public static Stats postHocAnalyzer(NeatGenome.NeatGenome genome) { Stats stats = new Stats(); FloatFastConcurrentNetwork ffcn = GenomeDecoder.DecodeToFloatFastConcurrentNetwork(genome, null); INetwork network; network = substrate.generateNetwork(ffcn); stats.NNconnections = ((FloatFastConcurrentNetwork)network).connectionArray.Length; double avgSpeed = 0; double totalTime = 0; int numFood = 0; double timetaken = 0; for (int i = 0; i < FoodGatherParams.foodLocations.Length; i++) { Board testingArena = new Board(0, 500); Robot tester = new Robot(new PointF(testingArena.Size.Width / 2.0F, testingArena.Size.Height / 2.0F), (int)FoodGatherParams.resolution, network); testingArena.AddRobot(tester); testingArena.AddFood(FoodGatherParams.foodLocations[i]); timetaken = testingArena.game(); if (timetaken < 1000) { numFood++; } totalTime += timetaken; } avgSpeed = totalTime / FoodGatherParams.foodLocations.Length; stats.numFoods = numFood; stats.avgSpeed = avgSpeed; return(stats); }