static LineairQueueString Split(string text) { var queue = new LineairQueueString(); Split(queue, text); return(queue); }
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)); }
/// <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(); }