Page 1 of 1

ReadPriceList

PostPosted: 04 Jul 2010, 15:46
by Rob Cashwalker
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:
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) {
It's kinda cool, you can hope for a better price to come along.... My most valuable card is Demonic Tutor, and it hovers in the 1000-1100 range, but one time it hit somewhere around 1600.