コード例 #1
0
        public ProgramFitnessFunction(Puzzle puzzle, IList<int> funcSlotCount)
        {
            Debug.Assert(puzzle != null && funcSlotCount != null && funcSlotCount.Count > 0);

            this.puzzle = puzzle;
            this.funcSlotCount = funcSlotCount;
            this.totalSlots = funcSlotCount.Sum();
        }
コード例 #2
0
        private void CreateFieldAndPuzzle()
        {
            for (int i = 0; i < FieldSideSize; ++i)
                for (int j = 0; j < FieldSideSize; ++j)
                {
                    Button button = this.FindResource("FieldButton") as Button;
                    Debug.Assert(button != null);

                    button.Name = string.Format("Field_{0}_{1}", j, i);
                    button.Click += fieldButton_Click;

                    this.fieldGrid.Children.Add(button);
                }

            this.puzzle = new Puzzle(FieldSideSize, FieldSideSize);
            this.puzzle.FieldColorChanged += this.puzzle_FieldColorChanged;
            this.puzzle.FieldStarStateChanged += this.puzzle_FieldStarStateChanged;
            this.puzzle.StartPositionChanged += this.puzzle_StartPositionChanged;
            this.puzzle.StartDirectionChanged += this.puzzle_StartDirectionChanged;
            this.puzzle.Reset();
        }