Ejemplo n.º 1
0
        static LineairQueueString Split(string text)
        {
            var queue = new LineairQueueString();

            Split(queue, text);
            return(queue);
        }
Ejemplo n.º 2
0
        static void Split(LineairQueueString queue, string text)
        {
            queue.Enqueue(text.Substring(text.Length - 1));
            if (text.Length == 1)
            {
                return;
            }

            Split(queue, text.Substring(0, text.Length - 1));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Start the AutoPlay. The game will first calculate all the required moves and store them in a Queue
        /// These moves are afterwards played 1 by 1 with the timer so that the user can see them happening.
        /// The speed slider allows to change the playback speed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btAutoPlay_Click(object sender, RoutedEventArgs e)
        {
            btAutoPlay.IsEnabled = false;           //During autoplay, it must not be possible to restart it
            slSpeed.IsEnabled    = false;
            Restart();                              //Reset the game

            moves = game.CalculateAllMoves();       //Calculate all the required moves and store them in a queue

            timer          = new DispatcherTimer(); //Create and start the timer
            timer.Interval = new TimeSpan(0, 0, 0, 0, (int)slSpeed.Value);
            timer.Tick    += Timer_Tick;
            timer.Start();
        }