Browse Source

finished creach addition, added case for 1 footsie

master
Pecha 9 months ago
parent
commit
7c692f0369
  1. 2
      .vscode/launch.json
  2. 2
      Creacher.cs
  3. 35
      Program.cs
  4. BIN
      bin/Debug/netcoreapp3.1/creachopedia.dll
  5. BIN
      bin/Debug/netcoreapp3.1/creachopedia.pdb
  6. 10
      creachopedia.json
  7. 20
      json.bak
  8. 10
      note.txt
  9. BIN
      obj/Debug/netcoreapp3.1/creachopedia.dll
  10. BIN
      obj/Debug/netcoreapp3.1/creachopedia.pdb

2
.vscode/launch.json

@ -14,7 +14,7 @@
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"console": "integratedTerminal",
"stopAtEntry": false
},
{

2
Creacher.cs

@ -43,6 +43,8 @@ namespace creachopedia {
if(this.footsies == 0){
Console.WriteLine("I cannot stip or step! I have 0 footsies! I am however quite powerful in my own way 0u0");
Console.WriteLine("Silly creacher...");
} else if(footsies == 1){
Console.WriteLine($"The {this.name} only has 1 footsie, but it does its best.");
} else {
Console.WriteLine($"The {this.name} steps, and rather well I might add.");
}

35
Program.cs

@ -13,14 +13,18 @@ namespace creachopedia {
var substatus = 1;
var tempdict = new Dictionary<string, string>();
var creacherdict = JsonConvert.DeserializeObject<Dictionary<string, Creacher>>(File.ReadAllText("creachopedia.json"));
// creacherdict.Add("paca", new GroundCreacher("paca", 4));
// creacherdict.Add("llama", new GroundCreacher("llama", 4));
// creacherdict.Add("stingray", new WaterCreacher("stingray", 0));
// var jsonsettings = new JsonSerializerSettings{
// TypeNameHandling = TypeNameHandling.Auto
// };
// string jsonstring = JsonConvert.SerializeObject(creacherdict, Formatting.Indented, jsonsettings);
// File.WriteAllText("creachopedia.json", jsonstring);
var shortdefs = new Dictionary<string, string>(){
{"a", "At"},
{"b", "Below"},
{"v", "Above"},
{"n", "None"},
{"w", "Walker"},
{"s", "Swimmer"},
{"h", "Hopper"},
{"f", "Flier"},
{"l", "Slitherer"},
{"i", "Incher"}
};
while (true) {
@ -46,6 +50,8 @@ namespace creachopedia {
case 5:
Console.WriteLine("Please enter your creacher's relation to the surface: [b]elow, [a]t, abo[v]e");
break;
case 6:
break;
}
break;
}
@ -120,15 +126,20 @@ namespace creachopedia {
var relsurfacematcher = new Regex(@"^[abv]$");
if (relsurfacematcher.Match(luserin).Success) {
tempdict.Add("surfacerel", luserin);
substatus ++;
substatus++;
}
else {
Console.WriteLine("Sorry, this surface relation did not match one of the three listed above. Please try again.");
}
}
else if (substatus == 6) {
return;
Console.WriteLine("test0");
var tempcreach = new Creacher(tempdict["name"], int.Parse(tempdict["footsies"]), tempdict["biome"], (Locomotion)Enum.Parse(typeof(Locomotion), shortdefs[tempdict["locomethod"]]), (SurfaceRel)Enum.Parse(typeof(SurfaceRel), shortdefs[tempdict["surfacerel"]]));
creacherdict.Add(tempdict["name"], tempcreach);
File.WriteAllText("creachopedia.json", JsonConvert.SerializeObject(creacherdict, Formatting.Indented));
Console.WriteLine("Creacher adde! 0u0");
status = "base";
substatus = 1;
}
foreach (var i in tempdict) {
Console.WriteLine("{0}:{1}", i.Key, i.Value);
@ -136,7 +147,7 @@ namespace creachopedia {
}
Console.WriteLine("");
Thread.Sleep(1000);
Thread.Sleep(500);
}
}
}

BIN
bin/Debug/netcoreapp3.1/creachopedia.dll

Binary file not shown.

BIN
bin/Debug/netcoreapp3.1/creachopedia.pdb

Binary file not shown.

10
creachopedia.json

@ -1,20 +1,22 @@
{
"paca": {
"$type": "creachopedia.GroundCreacher, creachopedia",
"type": "creacher of the land",
"name": "paca",
"_footsies": 4
},
"llama": {
"$type": "creachopedia.GroundCreacher, creachopedia",
"type": "creacher of the land",
"name": "llama",
"_footsies": 4
},
"stingray": {
"$type": "creachopedia.WaterCreacher, creachopedia",
"type": "creacher of the water",
"name": "stingray",
"_footsies": 0
}
},
"Snool": {
"type": "creacher of the urban",
"name": "Snool",
"_footsies": 1
}
}

20
json.bak

@ -0,0 +1,20 @@
{
"paca": {
"$type": "creachopedia.GroundCreacher, creachopedia",
"type": "creacher of the land",
"name": "paca",
"_footsies": 4
},
"llama": {
"$type": "creachopedia.GroundCreacher, creachopedia",
"type": "creacher of the land",
"name": "llama",
"_footsies": 4
},
"stingray": {
"$type": "creachopedia.WaterCreacher, creachopedia",
"type": "creacher of the water",
"name": "stingray",
"_footsies": 0
}
}

10
note.txt

@ -1,4 +1,10 @@
name, footsycount, biome///, locomotion, surfacerel,
name, footsycount, biome, locomotion, surfacerel,
None, Walker, Swimmer, Hopper, Flier, Slitherer, Incher
None, Walker, Swimmer, Hopper, Flier, Slitherer, Incher
FOR NEXT VERSION:
- individuals/species distinction
- ability to add individuals without a previously-created species by creating them together
- maybe get rid of Newtonsoft JSON stuff- polymorphism no longer necessary w/ sunsetting of inheritance

BIN
obj/Debug/netcoreapp3.1/creachopedia.dll

Binary file not shown.

BIN
obj/Debug/netcoreapp3.1/creachopedia.pdb

Binary file not shown.
Loading…
Cancel
Save