Test normal distribution in VariatorThree.
[lindosharp.git] / 2DTest / lindo / Scout.cs
blob8109c03a272a6b5d804918d4e33a4327ff950f48
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
6 namespace _2DTest.lindo
8 /** Collect information about our surroundings and tell where we are. */
9 class Scout
11 public Aggregator aggregator = new AggregatorThree();
12 public Comparator comparator = new ComparatorOne();
13 public WeightedShape shapeAll = null;
14 public WeightedShape shapeLast = null;
15 public Shape shapePoi = new Shape();
16 public Variator variator = new VariatorTwo();
17 public Motion MotionBest = null;
19 public void addShape(Shape shapeOne, Motion motionOne)
21 if (null == shapeAll)
23 shapeAll = new WeightedShape(shapeOne, 0.333);
25 else
27 WeightedShape shapeBest = null;
28 double weightBest = 0;
29 foreach (Motion motionTwo in variator.vary(motionOne))
31 WeightedShape shapeTwo = Transformator.move(shapeAll, motionTwo);
32 double weight = comparator.compare(shapeOne, shapeTwo.shape);
33 if (weight > weightBest)
35 shapeBest = shapeTwo;
36 weightBest = weight;
37 MotionBest = motionTwo;
40 if (null != shapeBest)
42 shapePoi = Transformator.move(shapePoi, MotionBest);
43 shapeLast = new WeightedShape(shapeOne, weightBest);
44 shapeAll = null == aggregator ? shapeBest : aggregator.aggregate(shapeBest, shapeLast);
45 System.Diagnostics.Debug.WriteLine("Weight:" + shapeAll.weight);