Skip to content

Commit f8ac088

Browse files
committed
Added the inspiration penalty for learning the same inspirationals in one session.
1 parent 210daef commit f8ac088

6 files changed

+24
-13
lines changed

SalemOptimizer/EvaluationState.cs

+11
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,24 @@ namespace SalemOptimizer
77
public class EvaluationState
88
{
99
private int[] proficiencies = new int[15];
10+
private int[] inspirationalUses = new int[InspirationalDatabase.Inspirationals.Count];
1011

1112
public void AddProficiency(ProficiencyKind kind, int value, double weight)
1213
{
1314
proficiencies[(int)kind] += value;
1415

1516
Inspiration += (int)(value * weight);
1617
}
18+
19+
public void AddInspirational(Inspirational inspirational)
20+
{
21+
var uses = inspirationalUses[inspirational.Id]++;
22+
23+
foreach (var prof in inspirational.Proficiencies)
24+
{
25+
AddProficiency(prof.Key, prof.Value, Math.Min(4d, 1d + uses * 0.5d));
26+
}
27+
}
1728

1829
public int GetValue(ProficiencyKind kind)
1930
{

SalemOptimizer/Inspirational.cs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ namespace SalemOptimizer
88
{
99
public class Inspirational
1010
{
11+
public int Id { get; set; }
12+
1113
public string Name { get; set; }
1214

1315
public int Uses { get; set; }

SalemOptimizer/InspirationalBranch.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,7 @@ public void Evaluate(EvaluationState engine)
7979

8080
foreach (var node in nodes)
8181
{
82-
foreach (var prof in node.Inspirational.Proficiencies)
83-
{
84-
engine.AddProficiency(prof.Key, prof.Value, node.Inspirational.Weight);
85-
}
82+
engine.AddInspirational(node.Inspirational);
8683
}
8784
}
8885

SalemOptimizer/InspirationalDatabase.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ static List<Inspirational> Load()
2121
.Select(row => row.Split('\t'))
2222
.Select
2323
(
24-
cols =>
24+
(cols, index) =>
2525
new Inspirational
2626
{
27+
Id = index,
2728
Name = cols[0],
2829
Proficiencies =
2930
cols

SalemOptimizer/Inspirationals.tab

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
A Taste of Autumn 300 575 875 245 620 435 520 3570 2
33
A Taste of The New World 450 260 400 360 500 230 2200 3
44
Abandoned Cobweb 450 550 450 350 900 725 3425 1
5-
Acorn Indian 250 550 800 450 700 450 800 4000 1
5+
Acorn Indian 2 250 550 800 450 700 450 800 4000 1
66
Aged Driftwood 1200 600 900 500 600 700 250 4750 1
77
Animal Canine 2500 2500 4250 9250 7
88
Argopelter Beak 1800 3200 1200 6200 1
@@ -51,7 +51,7 @@ Decorative Woodcarving 620 240 1280 350 500 500 3490 2
5151
Deer Antlers 450 850 2100 575 1750 5725 1
5252
Deer Hoof 675 1400 850 2250 620 1750 7545 1
5353
Dehydrated Rose 150 1500 1500 3150 1
54-
Devil's Wort 150 250 750 1125 45 2320 1
54+
Devil's Wort 1 150 250 750 1125 45 2320 1
5555
Dried Long Ear 250 950 970 750 800 200 3920 1
5656
Earthworm Python 750 780 1200 900 850 4480 1
5757
Eloped Gingerbread Man 850 1250 1300 950 2350 6700 3
@@ -62,7 +62,7 @@ Fine Beaver Teeth 550 1075 1550 900 800 500 5375 2
6262
Fish Skeleton 35 75 250 125 90 10 585 1
6363
Fishing Trophy 1250 1000 1850 1000 1700 1000 7800 6
6464
Five Nations' Dreamcatcher 1600 1250 1800 1000 1500 750 7900 1
65-
Flame Azalea 795 1300 180 230 290 2795 1
65+
Flame Azalea 1 795 1300 180 230 290 2795 1
6666
Flower Arrangement 1245 2575 1475 1620 885 7800 3
6767
Foetid Ooze 2150 4500 2000 2800 2050 13500 1
6868
Four-leaf Clover 2850 2230 1420 6500 13
@@ -165,7 +165,7 @@ The Wicked Wicker Man 2266 1200 2000 1250 2000 1400 10116 1
165165
Tiny Pocketwatch 1500 900 1350 1750 1750 7250 1
166166
Torn Tentacle 4250 2500 2500 9250 7
167167
Traces of the Lost Colony 3000 1500 2000 1500 2500 10500 1
168-
Trout Lily 290 225 275 715 1425 2930 1
168+
Trout Lily 1 290 225 275 715 1425 2930 1
169169
Tumbleweed 550 1440 1750 1350 850 5940 1
170170
Turkey Liver 3250 1350 2150 6750 3
171171
Turks Cap 380 1250 775 410 2815 1
@@ -178,7 +178,7 @@ Wee Menagerie 350 1050 1300 1300 900 4900 3
178178
Weighty Wattle 2000 750 1000 1500 500 5750 1
179179
Whispering Snake Skull 5000 2000 7000 1
180180
Wicker Man 775 850 800 750 75 3250 1
181-
Wild Columbine 260 210 230 635 1000 2335 1
181+
Wild Columbine 2 260 210 230 635 1000 2335 1
182182
Wild Garlic 2 200 550 400 390 450 200 2190 1
183183
Wild Oats 1500 1500 750 3750 1
184184
Windborne Kite 1250 1550 1550 1700 550 6600 5

SalemOptimizer/Properties/AssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.3.1.0")]
36-
[assembly: AssemblyFileVersion("1.3.1.0")]
37-
[assembly: AssemblyInformationalVersion("23. 1. 2015")]
35+
[assembly: AssemblyVersion("1.4.0.0")]
36+
[assembly: AssemblyFileVersion("1.4.0.0")]
37+
[assembly: AssemblyInformationalVersion("26. 1. 2015")]

0 commit comments

Comments
 (0)