From 373170f98e8fef2f949ef85b7d1fcb76852661e9 Mon Sep 17 00:00:00 2001 From: Anthony Leland Date: Wed, 28 Oct 2020 21:09:46 -0400 Subject: [PATCH] More change methods - Merge LimitToRange() extension method into other static values - Added social motive to printing of motive values --- motives.ipynb | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/motives.ipynb b/motives.ipynb index 00f6c9d..bbd6292 100644 --- a/motives.ipynb +++ b/motives.ipynb @@ -37,16 +37,9 @@ "source": [ "static Random rng = new Random();\n", "static int MaxMood = 60;\n", - "static int MaxMotive = 10;" - ], - "outputs": [] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "source": [ - "public static int LimitToRange(this int val, int min, int max)\n", + "static int MaxMotive = 10;\n", + "\n", + "static int LimitToRange(this int val, int min, int max)\n", "{\n", " if (val < min) { return min; }\n", " if (val > max) { return max; }\n", @@ -130,6 +123,16 @@ " {\n", " Fun = CalcuateMotiveChange(Fun, input);\n", " }\n", + "\n", + " public void ChangeBladder(int input)\n", + " {\n", + " Bladder = CalcuateMotiveChange(Bladder, input);\n", + " }\n", + "\n", + " public void ChangeSocial(int input)\n", + " {\n", + " Social = CalcuateMotiveChange(Social, input);\n", + " }\n", "}" ], "outputs": [] @@ -149,6 +152,7 @@ "Console.WriteLine($\"Hunger: {motives.Hunger}{Environment.NewLine}\" +\n", " $\"Fun: {motives.Fun}{Environment.NewLine}\" +\n", " $\"Bladder: {motives.Bladder}{Environment.NewLine}\" +\n", + " $\"Social: {motives.Social}{Environment.NewLine}\" +\n", " $\"Environment: {motives.Environment}\");\n", "Console.WriteLine($\"Mood: {motives.Mood}\");" ], @@ -161,8 +165,12 @@ "source": [ "motives.ChangeHunger(rng.Next(MaxMotive));\n", "motives.ChangeFun(rng.Next(MaxMotive));\n", + "motives.ChangeSocial(rng.Next(MaxMotive));\n", + "motives.ChangeBladder(rng.Next(MaxMotive));\n", "Console.WriteLine($\"New Hunger: {motives.Hunger}{Environment.NewLine}\" +\n", - " $\"New Fun: {motives.Fun}\");\n", + " $\"New Fun: {motives.Fun}{Environment.NewLine}\" +\n", + " $\"New Bladder: {motives.Bladder}{Environment.NewLine}\" +\n", + " $\"New Social: {motives.Social}\");\n", "Console.WriteLine($\"New Mood: {motives.Mood}\");" ], "outputs": []