mirror of
https://github.com/simtactics/servo.git
synced 2025-03-15 00:21:20 +00:00
More change methods
- Merge LimitToRange() extension method into other static values - Added social motive to printing of motive values
This commit is contained in:
parent
731cf826fd
commit
373170f98e
1 changed files with 19 additions and 11 deletions
|
@ -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": []
|
||||
|
|
Loading…
Add table
Reference in a new issue