initial commit
This commit is contained in:
commit
65c137cec1
32 changed files with 420 additions and 0 deletions
35
MadLib/Program.cs
Normal file
35
MadLib/Program.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
namespace MadLib;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var category = GetChoice();
|
||||
var storyGenerator = new StoryGenerator(category);
|
||||
|
||||
storyGenerator.Generate();
|
||||
}
|
||||
|
||||
private static StoryGenerator.Categories GetChoice()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Console.WriteLine("Choose a category:");
|
||||
StoryGenerator.DisplayCategories();
|
||||
|
||||
var choice = Console.ReadLine();
|
||||
if (string.IsNullOrWhiteSpace(choice))
|
||||
{
|
||||
Console.WriteLine("Invalid input.");
|
||||
continue;
|
||||
}
|
||||
|
||||
var selectedCategory = int.Parse(choice.Trim()) - 1;
|
||||
|
||||
if (Enum.IsDefined(typeof(StoryGenerator.Categories), selectedCategory))
|
||||
return (StoryGenerator.Categories)selectedCategory;
|
||||
|
||||
Console.WriteLine("Please enter a valid category.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue