Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Game" /> class.
        /// </summary>
        /// <param name="numberOfDisks">The number of disks.</param>
        /// <param name="randomize">if set to <c>true</c>, randomize the stacks.</param>
        public Game(int numberOfDisks, bool randomize = false)
        {
            this.InitializeComponent();

            var ctrl = new HanoiTowers(numberOfDisks);

            if (randomize)
            {
                ctrl.Randomize();
            }

            this.MainGrid.Children.Add(ctrl);
            ctrl.ValidMoveMade    += this.Towers_ValidMoveMade;
            ctrl.FullStackCreated += this.Towers_FullStackCreated;

            this.DataContext = this.status = new GameStatus(numberOfDisks);
            this.randomize   = randomize;
        }
Пример #2
0
        public void Test()
        {
            var sut = new HanoiTowers(2);

            sut.Solve();
        }