From 731cf826fdea76adcab39833375ee9a9e4f70490 Mon Sep 17 00:00:00 2001 From: Anthony Leland Date: Wed, 28 Oct 2020 20:58:13 -0400 Subject: [PATCH] Move max values to top, take two --- motives.ipynb | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/motives.ipynb b/motives.ipynb index 7d49485..00f6c9d 100644 --- a/motives.ipynb +++ b/motives.ipynb @@ -23,13 +23,21 @@ ], "outputs": [] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "For this experiment, the current motives are randomized with a max of 10. If this were a game, the max would be 100 with a downward increment throughout the day." + ] + }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "source": [ - "var rng = new Random();\n", - "var MaxMood = 60;" + "static Random rng = new Random();\n", + "static int MaxMood = 60;\n", + "static int MaxMotive = 10;" ], "outputs": [] }, @@ -91,7 +99,6 @@ " // until it reaches it's max motive.\n", " int CalcuateMotiveChange(int motive, int input)\n", " {\n", - " var maxMotive = 10;\n", " var curMotive = motive;\n", " var curMood = Mood;\n", "\n", @@ -102,12 +109,12 @@ " var newMood = newMotive + curMood;\n", "\n", " // Changed motive is the new motive with the limit\n", - " var changedMotive = newMotive.LimitToRange(0, maxMotive);\n", + " var changedMotive = newMotive.LimitToRange(0, MaxMotive);\n", "\n", " // Does the new motive increase my current motive?\n", " // Does the new motive increase my overall mood?\n", " if (changedMotive >= curMotive && curMood <= newMood \n", - " && changedMotive <= maxMotive && curMood <= MaxMood)\n", + " && changedMotive <= MaxMotive && curMood <= MaxMood)\n", " return changedMotive;\n", " \n", " // Fall back to the current movement\n", @@ -127,15 +134,6 @@ ], "outputs": [] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Set the motives\n", - "\n", - "For this experiement we use an " - ] - }, { "cell_type": "code", "execution_count": 1, @@ -144,9 +142,10 @@ "// Max a motive can be is 10. With all motives combined, the\n", "// the max can be about 60. In-game, this is always going down\n", "// to whatever degree.\n", - "var motives = new Motives(hunger: rng.Next(10), bladder: rng.Next(10),\n", - "fun: rng.Next(10), energy: rng.Next(10), \n", - "environment: 10, social: rng.Next(10));\n", + "var motives = new Motives(hunger: rng.Next(MaxMotive), \n", + "bladder: rng.Next(MaxMotive), fun: rng.Next(MaxMotive), \n", + "energy: rng.Next(MaxMotive), environment: MaxMotive, \n", + "social: rng.Next(MaxMotive));\n", "Console.WriteLine($\"Hunger: {motives.Hunger}{Environment.NewLine}\" +\n", " $\"Fun: {motives.Fun}{Environment.NewLine}\" +\n", " $\"Bladder: {motives.Bladder}{Environment.NewLine}\" +\n", @@ -160,11 +159,11 @@ "execution_count": 1, "metadata": {}, "source": [ - "motives.ChangeHunger(rng.Next(10));\n", - "motives.ChangeFun(rng.Next(10));\n", - "Console.WriteLine($\"Hunger: {motives.Hunger}{Environment.NewLine}\" +\n", - " $\"Fun: {motives.Fun}\");\n", - "Console.WriteLine($\"Mood: {motives.Mood}\");" + "motives.ChangeHunger(rng.Next(MaxMotive));\n", + "motives.ChangeFun(rng.Next(MaxMotive));\n", + "Console.WriteLine($\"New Hunger: {motives.Hunger}{Environment.NewLine}\" +\n", + " $\"New Fun: {motives.Fun}\");\n", + "Console.WriteLine($\"New Mood: {motives.Mood}\");" ], "outputs": [] }