ReadPriceList
I committed a change to ReadPriceList.
It randomly modifies the prices as it reads the file.
90% of the time the modification is +/- 0-10%.
10% of the time the modification is +/- 0-50%.
This is the section I changed:
It randomly modifies the prices as it reads the file.
90% of the time the modification is +/- 0-10%.
10% of the time the modification is +/- 0-50%.
This is the section I changed:
- Code: Select all
try {
long val = Long.parseLong(price.trim());
if(!(name.equals("Plains") || name.equals("Island") || name.equals("Swamp") || name.equals("Mountain") || name.equals("Forest") ||
name.equals("Snow-Covered Plains") || name.equals("Snow-Covered Island") || name.equals("Snow-Covered Swamp") || name.equals("Snow-Covered Mountain") || name.equals("Snow-Covered Forest") ))
{
float ff = 0;
if (r.nextInt(100) < 90) // +/- 10%
ff = (float) r.nextInt(10) * (float) .01;
else // +/- 50%
ff = (float) r.nextInt(50) * (float) .01;
if (r.nextInt(100) < 50) // -ff%
val = (long) ((float) val * ((float) 1 - ff));
else // +ff%
val = (long) ((float) val * ((float) 1 + ff));
}
map.put(name, val);
} catch (NumberFormatException nfe) {