|
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using Towel; |
|
|
|
class Program |
|
{ |
|
public enum Location |
|
{ |
|
Rivendell, |
|
Trail1, |
|
Gondor, |
|
Trail2, |
|
Mordor, |
|
SanFrancisco, |
|
} |
|
|
|
static Dictionary<Location, Location[]> AdjacentLocations = new() |
|
{ |
|
{ Location.Rivendell, new[] { Location.Trail1, Location.SanFrancisco } }, |
|
{ Location.Trail1, new[] { Location.Rivendell, Location.Gondor } }, |
|
{ Location.Gondor, new[] { Location.Trail1, Location.Trail2 } }, |
|
{ Location.Trail2, new[] { Location.Gondor, Location.Mordor, Location.SanFrancisco, } }, |
|
{ Location.Mordor, new[] { Location.SanFrancisco, Location.Trail2, Location.Rivendell, } }, |
|
{ Location.SanFrancisco, new[] { Location.Mordor, Location.Trail2, Location.Rivendell, } }, |
|
}; |
|
|
|
static void Main() |
|
{ |
|
Location location = Location.Rivendell; |
|
bool exit = false; |
|
while (!exit) |
|
{ |
|
var adjacents = AdjacentLocations[location]; |
|
List<(string, Action)> menuOptions = new(); |
|
foreach (Location adjacent in adjacents) |
|
{ |
|
menuOptions.Add((adjacent.ToString(), () => location = adjacent)); |
|
} |
|
menuOptions.Add(("Exit Game", () => exit = true)); |
|
Console.Clear(); |
|
ConsoleHelper.IntMenu( |
|
title: $"You are in {location}.", |
|
prompt: "Where To Next? ", |
|
invalidMessage: default, |
|
menuOptions.ToArray()); |
|
} |
|
ConsoleHelper.PromptPressToContinue(); |
|
} |
|
} |