static void Main(string[] args) { Console.WriteLine(format + "Welcome to Cade's take on the classic game : 'Snakes and Ladders!'"); Console.WriteLine(format + "This humble application began as a CodeWars challenge, but I was having fun and so I fleshed it out."); Console.WriteLine(format + "The map for the Gameboard in this app can be found at: "); Console.Write("\t" + "https://raw.githubusercontent.com/adrianeyre/codewars/master/Ruby/Authored/snakesandladdersboard.jpg"); Console.WriteLine(); Console.WriteLine(format + "Please, enjoy with a friend or coworker =)"); Console.ReadLine(); try { PlayGame.GameStart(); } catch (FormatException fEx) { Console.WriteLine(format + fEx.Message); } //I included a finally block so that my Application will exit gracefully even if an exception occurs finally { Console.WriteLine(format + "Thanks so much for checking out my application!"); Console.WriteLine(format + "Be sure to check out the rest of my portfolio at https://github.com/cadedillon!"); } }
//PlayAgain is a simple method that asks if the user wants to play another game of Snakes and Ladders //returning control to the GameStart method if they do. //If they don't want to play again, the method returns void and control is passed to the finally block of the Main method. public static void PlayAgain() { Console.WriteLine(format + "Would you like to play again?"); Console.WriteLine(format + "Enter 1 to play again, any other key to exit."); int userInput = int.Parse(Console.ReadLine()); if (userInput == 1) { PlayGame.GameStart(); } else { return; } }