diff --git a/Creacher.cs b/Creacher.cs index 988f601..49e2936 100644 --- a/Creacher.cs +++ b/Creacher.cs @@ -2,6 +2,20 @@ using System; using Newtonsoft.Json; namespace creachopedia { + enum Locomotion { + None, //barnacles, plants and so on + Walker, + Swimmer, + Hopper, + Flier, + Slitherer, + Incher // snails et al + } + enum SurfaceRel { + Below, + At, + Above + } class Creacher { public string name {get; set;} // public int kingdom; @@ -11,10 +25,15 @@ namespace creachopedia { [JsonIgnore] public int footsies {get { return this._footsies; } set { Console.WriteLine("What do you think you're doing?! 0uo Leave those footsies alone!!!"); }} public string type = "simple creacher"; + Locomotion locoStyle {get; set;} + SurfaceRel height {get; set;} - public Creacher(string name, int footsyCount = 4) { + public Creacher(string name, int footsyCount = 4, string biome = "land", Locomotion locoStyle = Locomotion.Walker, SurfaceRel height = SurfaceRel.At) { this.name = name; this._footsies = footsyCount; + this.type = $"creacher of the {biome}"; + this.locoStyle = locoStyle; + this.height = height; } public void Introduce() { diff --git a/Program.cs b/Program.cs index 85a794c..2e37780 100644 --- a/Program.cs +++ b/Program.cs @@ -3,11 +3,15 @@ using System.Collections.Generic; using System.Threading; using Newtonsoft.Json; using System.IO; +using System.Text.RegularExpressions; namespace creachopedia { class Program { static void Main(string[] args) { + var status = "base"; + var substatus = 1; + var tempdict = new Dictionary(); var creacherdict = JsonConvert.DeserializeObject>(File.ReadAllText("creachopedia.json")); // creacherdict.Add("paca", new GroundCreacher("paca", 4)); // creacherdict.Add("llama", new GroundCreacher("llama", 4)); @@ -20,49 +24,120 @@ namespace creachopedia { while (true) { - var status = "base"; - Console.WriteLine("Please input a creacher name, or (q) to quit 0u0"); + switch (status) { + case "base": + Console.WriteLine("Please input a creacher name, (a) to add a creacher, or (q) to quit 0u0"); + break; + case "add": + switch (substatus) { + case 1: + Console.WriteLine("Please enter a name for the creacher! Or type (b) for previous category, or (q) to cancel addition entirely."); + break; + case 2: + Console.WriteLine("How many footsies? 0u0 (numerals only plz)"); + break; + case 3: + Console.WriteLine("Please enter a biome (lowercase open text field)"); + break; + case 4: + Console.WriteLine("Please enter a method of locomotion:"); + Console.WriteLine("[n]one, [w]alker, [s]wimmer, [h]opper, [f]lier, s[l]itherer, [i]ncher"); + break; + case 5: + Console.WriteLine("Please enter your creacher's relation to the surface: [b]elow, [a]t, abo[v]e"); + break; + } + break; + } + string userin = Console.ReadLine(); string luserin = userin.ToLower(); - - if(userin == "q"){ + + if (luserin == "q" || luserin == "quit") { Console.WriteLine("Thank you for using the CreachoPedia, please come again!!!!"); - status = "quit"; + return; } - if (status == "base"){ + if (status == "base") { if (creacherdict.ContainsKey(userin)) { creacherdict[userin].Introduce(); creacherdict[userin].Step(); } - else if(luserin == "heenlo!" || luserin == "henlo" || luserin == "heenlo" || luserin == "henlo!"){ + else if (luserin == "heenlo!" || luserin == "henlo" || luserin == "heenlo" || luserin == "henlo!") { Console.WriteLine("Well heenlo to you too! 0u0"); } - else if(userin == "*pats*"){ + else if (userin == "*pats*") { Console.WriteLine("Oh! Thank you!"); } - else if(userin == "a"){ - Console.WriteLine("Please enter a new creacher! Or type (b) for previous category, or (q) to cancel addition entirely."); - status = "add"; - } - } + else if (luserin == "a" || luserin == "add") { + status = "add"; + } + else { + Console.WriteLine($"I don't know what {userin} is! What on boo Earth?!!?!?!?"); + } + } else if (status == "add") { + if (substatus == 1) { + tempdict = new Dictionary(); + var namematcher = new Regex(@"[^ ].[A-Za-z\- ]{2,}(?= 5) { + Console.WriteLine("That's a lot of footsies!!!! 0u0"); + } + if (footsiecounter % 2 == 1) { + Console.WriteLine("An odd number of footsies? What a strange creacher!"); + } + substatus ++; + } + else { + Console.WriteLine("Sorry, this is not a number!"); + } + } + else if (substatus == 3) { + tempdict.Add("biome", luserin); + substatus ++; + } + else if (substatus == 4) { + var locomatcher = new Regex(@"^[nwshfli]$"); + if (locomatcher.Match(userin).Success) { + tempdict.Add("locomethod", userin); + substatus++; + } + else { + Console.WriteLine("Sorry, this type is invalid, please try again."); + } + } + else if (substatus == 5) { + var relsurfacematcher = new Regex(@"^[abv]$"); + if (relsurfacematcher.Match(luserin).Success) { + tempdict.Add("surfacerel", luserin); + substatus ++; + } - } else if (status == "quit") { - return; + else { + Console.WriteLine("Sorry, this surface relation did not match one of the three listed above. Please try again."); + } + } + else if (substatus == 6) { + return; + } + foreach (var i in tempdict) { + Console.WriteLine("{0}:{1}", i.Key, i.Value); + } } - - - - else { - Console.WriteLine($"I don't know what {userin} is! What on boo Earth?!!?!?!?"); - } Console.WriteLine(""); Thread.Sleep(1000); } - - - } } } diff --git a/bin/Debug/netcoreapp3.1/creachopedia.dll b/bin/Debug/netcoreapp3.1/creachopedia.dll index 4276ef6..9c510e3 100644 Binary files a/bin/Debug/netcoreapp3.1/creachopedia.dll and b/bin/Debug/netcoreapp3.1/creachopedia.dll differ diff --git a/bin/Debug/netcoreapp3.1/creachopedia.pdb b/bin/Debug/netcoreapp3.1/creachopedia.pdb index 702ac2b..f58a7ab 100644 Binary files a/bin/Debug/netcoreapp3.1/creachopedia.pdb and b/bin/Debug/netcoreapp3.1/creachopedia.pdb differ diff --git a/note.txt b/note.txt new file mode 100644 index 0000000..9ca607e --- /dev/null +++ b/note.txt @@ -0,0 +1,4 @@ +name, footsycount, biome///, locomotion, surfacerel, + + +None, Walker, Swimmer, Hopper, Flier, Slitherer, Incher \ No newline at end of file diff --git a/obj/Debug/netcoreapp3.1/creachopedia.dll b/obj/Debug/netcoreapp3.1/creachopedia.dll index 4276ef6..9c510e3 100644 Binary files a/obj/Debug/netcoreapp3.1/creachopedia.dll and b/obj/Debug/netcoreapp3.1/creachopedia.dll differ diff --git a/obj/Debug/netcoreapp3.1/creachopedia.pdb b/obj/Debug/netcoreapp3.1/creachopedia.pdb index 702ac2b..f58a7ab 100644 Binary files a/obj/Debug/netcoreapp3.1/creachopedia.pdb and b/obj/Debug/netcoreapp3.1/creachopedia.pdb differ