Example #1
0
        private AiStrategy BuildAiStrategy(TreeSpec spec)
        {
            var tree         = _treeBuilder.BuildTree <TROOTNODE>(_treebuildingstrategy.WithSpec(spec));
            var aiStrategyId = new AiStrategy.AiStrategyId();

            return(new AiStrategy(tree as Function <ResponseVotes>, aiStrategyId));
        }
Example #2
0
        public Population BuildPopulation(int size, TreeSpec spec)
        {
            var population = new Population();

            size.Times(() => population.Add(BuildAiStrategy(spec)));
            return(population);
        }
Example #3
0
        public void Set_a_parent_must_change_is_root_value()
        {
            var root = new TreeSpec(5);
            var leaf = new TreeSpec(5);

            leaf.SetParent(root);

            Assert.IsTrue(root.IsRoot);
            Assert.IsFalse(leaf.IsRoot);
        }
Example #4
0
        public void FixtureSetUp()
        {
            _container = new AiBootstrapper().BootstrapContainer();
            _container.SetDefaultsToProfile("FunctionalTests");

            _strategy = _container.GetInstance <FullTreeStrategy>();
            var spec = new TreeSpec {
                MaxDepth = 150
            };

            _strategy.WithSpec(spec);
            var treeBuilder = _container.GetInstance <TreeBuilder>();

            _tree = treeBuilder.BuildTree <CombineVotes>(_strategy);
            var size = new TreeSizeVisitor();

            _tree.Receive(size);
        }
Example #5
0
        public void Create_a_root_node_must_have_not_a_parent()
        {
            var root = new TreeSpec(5);

            Assert.IsTrue(root.IsRoot);
        }
Example #6
0
 public AiPlayerBuilder WithTreeSpec(TreeSpec treeSpec)
 {
     _treeSpec = treeSpec;
     return(this);
 }