-It can tell you the overall CL of a given set of rings.
-It can plan a level-up strategy for you.
The only problem is that you'll only be able to run it if you have the ability to compile Java code on your machine. I guess I won't worry about that and I'll just demonstrate it working.
Finding overall CL
Specifically, run the Rings class with the ring CLs as its parameters. More generally, you type something like this from the command prompt:
java Rings 5.0 4.0 4.0 3.0 4.0 5.0 4.0 4.0
and it'll give you the results:
/Users/ekraft/ekraft/gaia/zomg > java Rings 5.0 4.0 4.0 3.0 4.0 5.0 4.0 4.0
Overall CL: 4.4
(Exact value: 79/18)
Total orbs: 530
Overall CL: 4.4
(Exact value: 79/18)
Total orbs: 530
If it's easier for you, you can give the name of each ring (although it doesn't make a difference here):
/Users/ekraft/ekraft/gaia/zomg > java Rings SharkAttack=5.0 Hack=4.0 Slash=4.0 KeenAye=3.0 Mantis=4.0 Dervish=5.0 Shuriken=4.0 Ghost=4.0
Overall CL: 4.4
(Exact value: 79/18)
Total orbs: 530
Overall CL: 4.4
(Exact value: 79/18)
Total orbs: 530
(Ring names cannot have spaces, numbers, or symbols so stick with uppercase and lowercase letters. 3nodding )
As you can see, both pieces of code report exactly the same thing so you can use whichever helps you the most. smile
Level Up Planning
Okay, I mentioned the optimal use of orbs from before... optimal from the point of view of obtaining the highest overall CL. This program also has the ability to figure that out as well, even from your own randomly-constructed set!
As a nice simple example, here's what it tells me about my current set:
/Users/ekraft/ekraft/gaia/zomg > java Planner Mantis=8.0 Bump=8.0 Diagnosis=8.8 Fitness=9.0 HuntersBow=8.0 HealingHalo=8.0 Divinity=8.0 Wish=8.0
Start status: Overall CL: 8.4, Total Orbs: 2384
Fitness raised to CL 10.0 (Overall CL: 8.6, Total Orbs: 2474)
Diagnosis raised to CL 9.0 (Overall CL: 8.6, Total Orbs: 2490)
Diagnosis raised to CL 10.0 (Overall CL: 8.8, Total Orbs: 2580)
Mantis raised to CL 9.0 (Overall CL: 9.0, Total Orbs: 2660)
Mantis raised to CL 10.0 (Overall CL: 9.2, Total Orbs: 2750)
Bump raised to CL 9.0 (Overall CL: 9.3, Total Orbs: 2830)
Bump raised to CL 10.0 (Overall CL: 9.4, Total Orbs: 2920)
HuntersBow raised to CL 9.0 (Overall CL: 9.6, Total Orbs: 3000)
HuntersBow raised to CL 10.0 (Overall CL: 9.7, Total Orbs: 3090)
HealingHalo raised to CL 9.0 (Overall CL: 9.8, Total Orbs: 3170)
HealingHalo raised to CL 10.0 (Overall CL: 9.8, Total Orbs: 3260)
Divinity raised to CL 9.0 (Overall CL: 9.9, Total Orbs: 3340)
Divinity raised to CL 10.0 (Overall CL: 9.9, Total Orbs: 3430)
Wish raised to CL 9.0 (Overall CL: 10.0, Total Orbs: 3510)
Wish raised to CL 10.0 (Overall CL: 10.0, Total Orbs: 3600)
Start status: Overall CL: 8.4, Total Orbs: 2384
Fitness raised to CL 10.0 (Overall CL: 8.6, Total Orbs: 2474)
Diagnosis raised to CL 9.0 (Overall CL: 8.6, Total Orbs: 2490)
Diagnosis raised to CL 10.0 (Overall CL: 8.8, Total Orbs: 2580)
Mantis raised to CL 9.0 (Overall CL: 9.0, Total Orbs: 2660)
Mantis raised to CL 10.0 (Overall CL: 9.2, Total Orbs: 2750)
Bump raised to CL 9.0 (Overall CL: 9.3, Total Orbs: 2830)
Bump raised to CL 10.0 (Overall CL: 9.4, Total Orbs: 2920)
HuntersBow raised to CL 9.0 (Overall CL: 9.6, Total Orbs: 3000)
HuntersBow raised to CL 10.0 (Overall CL: 9.7, Total Orbs: 3090)
HealingHalo raised to CL 9.0 (Overall CL: 9.8, Total Orbs: 3170)
HealingHalo raised to CL 10.0 (Overall CL: 9.8, Total Orbs: 3260)
Divinity raised to CL 9.0 (Overall CL: 9.9, Total Orbs: 3340)
Divinity raised to CL 10.0 (Overall CL: 9.9, Total Orbs: 3430)
Wish raised to CL 9.0 (Overall CL: 10.0, Total Orbs: 3510)
Wish raised to CL 10.0 (Overall CL: 10.0, Total Orbs: 3600)
Now, the truth of the matter is that I simply gave it the rings I was wearing in the order I was wearing them, but perhaps I value some rings over others? Then I give it those rings in the order I value them:
/Users/ekraft/ekraft/gaia/zomg > java Planner Fitness=9.0 Bump=8.0 Mantis=8.0 Diagnosis=8.8 HuntersBow=8.0 Divinity=8.0 Wish=8.0 HealingHalo=8.0
Start status: Overall CL: 8.4, Total Orbs: 2384
Fitness raised to CL 10.0 (Overall CL: 8.6, Total Orbs: 2474)
Diagnosis raised to CL 9.0 (Overall CL: 8.6, Total Orbs: 2490)
Diagnosis raised to CL 10.0 (Overall CL: 8.8, Total Orbs: 2580)
Bump raised to CL 9.0 (Overall CL: 9.0, Total Orbs: 2660)
Bump raised to CL 10.0 (Overall CL: 9.2, Total Orbs: 2750)
Mantis raised to CL 9.0 (Overall CL: 9.3, Total Orbs: 2830)
Mantis raised to CL 10.0 (Overall CL: 9.4, Total Orbs: 2920)
HuntersBow raised to CL 9.0 (Overall CL: 9.6, Total Orbs: 3000)
HuntersBow raised to CL 10.0 (Overall CL: 9.7, Total Orbs: 3090)
Divinity raised to CL 9.0 (Overall CL: 9.8, Total Orbs: 3170)
Divinity raised to CL 10.0 (Overall CL: 9.8, Total Orbs: 3260)
Wish raised to CL 9.0 (Overall CL: 9.9, Total Orbs: 3340)
Wish raised to CL 10.0 (Overall CL: 9.9, Total Orbs: 3430)
HealingHalo raised to CL 9.0 (Overall CL: 10.0, Total Orbs: 3510)
HealingHalo raised to CL 10.0 (Overall CL: 10.0, Total Orbs: 3600)
Start status: Overall CL: 8.4, Total Orbs: 2384
Fitness raised to CL 10.0 (Overall CL: 8.6, Total Orbs: 2474)
Diagnosis raised to CL 9.0 (Overall CL: 8.6, Total Orbs: 2490)
Diagnosis raised to CL 10.0 (Overall CL: 8.8, Total Orbs: 2580)
Bump raised to CL 9.0 (Overall CL: 9.0, Total Orbs: 2660)
Bump raised to CL 10.0 (Overall CL: 9.2, Total Orbs: 2750)
Mantis raised to CL 9.0 (Overall CL: 9.3, Total Orbs: 2830)
Mantis raised to CL 10.0 (Overall CL: 9.4, Total Orbs: 2920)
HuntersBow raised to CL 9.0 (Overall CL: 9.6, Total Orbs: 3000)
HuntersBow raised to CL 10.0 (Overall CL: 9.7, Total Orbs: 3090)
Divinity raised to CL 9.0 (Overall CL: 9.8, Total Orbs: 3170)
Divinity raised to CL 10.0 (Overall CL: 9.8, Total Orbs: 3260)
Wish raised to CL 9.0 (Overall CL: 9.9, Total Orbs: 3340)
Wish raised to CL 10.0 (Overall CL: 9.9, Total Orbs: 3430)
HealingHalo raised to CL 9.0 (Overall CL: 10.0, Total Orbs: 3510)
HealingHalo raised to CL 10.0 (Overall CL: 10.0, Total Orbs: 3600)
The code
These are the four classes I made for this little project:
Fraction.java - Used for exact fraction information
Ring.java - Represents a ring
Rings.java - Represents the rings you're wearing / using
Planner.java - Plans a level-up strategy for your rings
You'll need all four to run the planner, but only the first three to run the overall CL calculator. 3nodding
Fraction.java
import java.util.*;
public class Fraction
implements Comparable {
protected long quotient;
protected long divisor;
public Fraction(long integer) {
quotient = integer;
divisor = 1;
}
public Fraction(long top,
long bottom) {
if (bottom == 0) {
throw new IllegalArgumentException("Division by zero")
}
if (bottom < 0) {
top = -top;
bottom = -bottom;
}
quotient = top;
divisor = bottom;
}
public Fraction add(Fraction toAdd) {
long newTop = quotient * toAdd.divisor + toAdd.quotient * divisor;
long newBottom = divisor * toAdd.divisor;
Fraction result = new Fraction(newTop, newBottom)
return result.reduce()
}
public Fraction subtract(Fraction toSub) {
long newTop = quotient * toSub.divisor - toSub.quotient * divisor;
long newBottom = divisor * toSub.divisor;
Fraction result = new Fraction(newTop, newBottom)
return result.reduce()
}
public Fraction multiply(Fraction toMult) {
long newTop = quotient * toMult.quotient;
long newBottom = divisor * toMult.divisor;
Fraction result = new Fraction(newTop, newBottom)
return result.reduce()
}
public Fraction divide(Fraction toDiv) {
long newTop = quotient * toDiv.divisor;
long newBottom = divisor * toDiv.quotient;
Fraction result = new Fraction(newTop, newBottom)
return result.reduce()
}
public Fraction reduce() {
List qFactors = factor(quotient)
List dFactors = factor(divisor)
Iterator qIterator = qFactors.iterator()
Iterator dIterator = dFactors.iterator()
long dCurrent = dIterator.next()
while (qIterator.hasNext()) {
long qCurrent = qIterator.next()
while (dCurrent < qCurrent) {
if (dIterator.hasNext() == false) {
return this;
}
dCurrent = dIterator.next()
}
if (qCurrent < dCurrent) {
continue;
}
quotient /= qCurrent;
divisor /= dCurrent;
if (dIterator.hasNext() == false) {
return this;
}
dCurrent = dIterator.next()
}
return this;
}
private static List factor(long value) {
List results = new LinkedList()
factor(value, results)
return results;
}
private static void factor(long value,
List factors) {
long current = 2;
while (true) {
if (current * current > value) {
factors.add(value)
return;
}
if (value % current == 0) {
factors.add(current)
factor(value / current, factors)
return;
}
current++;
}
}
public boolean equals(Object object) {
if ((object == null) ||
(object instanceof Fraction) == false) {
return false;
}
Fraction fraction = (Fraction) object;
return (value() == fraction.value())
}
public double value() {
return (double)quotient / (double)divisor;
}
public String toString() {
return quotient + "/" + divisor;
}
public int compareTo(Fraction fraction) {
return (int)(quotient * fraction.divisor - fraction.quotient * divisor)
}
}
public class Fraction
implements Comparable
protected long quotient;
protected long divisor;
public Fraction(long integer) {
quotient = integer;
divisor = 1;
}
public Fraction(long top,
long bottom) {
if (bottom == 0) {
throw new IllegalArgumentException("Division by zero")
}
if (bottom < 0) {
top = -top;
bottom = -bottom;
}
quotient = top;
divisor = bottom;
}
public Fraction add(Fraction toAdd) {
long newTop = quotient * toAdd.divisor + toAdd.quotient * divisor;
long newBottom = divisor * toAdd.divisor;
Fraction result = new Fraction(newTop, newBottom)
return result.reduce()
}
public Fraction subtract(Fraction toSub) {
long newTop = quotient * toSub.divisor - toSub.quotient * divisor;
long newBottom = divisor * toSub.divisor;
Fraction result = new Fraction(newTop, newBottom)
return result.reduce()
}
public Fraction multiply(Fraction toMult) {
long newTop = quotient * toMult.quotient;
long newBottom = divisor * toMult.divisor;
Fraction result = new Fraction(newTop, newBottom)
return result.reduce()
}
public Fraction divide(Fraction toDiv) {
long newTop = quotient * toDiv.divisor;
long newBottom = divisor * toDiv.quotient;
Fraction result = new Fraction(newTop, newBottom)
return result.reduce()
}
public Fraction reduce() {
List
List
Iterator
Iterator
long dCurrent = dIterator.next()
while (qIterator.hasNext()) {
long qCurrent = qIterator.next()
while (dCurrent < qCurrent) {
if (dIterator.hasNext() == false) {
return this;
}
dCurrent = dIterator.next()
}
if (qCurrent < dCurrent) {
continue;
}
quotient /= qCurrent;
divisor /= dCurrent;
if (dIterator.hasNext() == false) {
return this;
}
dCurrent = dIterator.next()
}
return this;
}
private static List
List
factor(value, results)
return results;
}
private static void factor(long value,
List
long current = 2;
while (true) {
if (current * current > value) {
factors.add(value)
return;
}
if (value % current == 0) {
factors.add(current)
factor(value / current, factors)
return;
}
current++;
}
}
public boolean equals(Object object) {
if ((object == null) ||
(object instanceof Fraction) == false) {
return false;
}
Fraction fraction = (Fraction) object;
return (value() == fraction.value())
}
public double value() {
return (double)quotient / (double)divisor;
}
public String toString() {
return quotient + "/" + divisor;
}
public int compareTo(Fraction fraction) {
return (int)(quotient * fraction.divisor - fraction.quotient * divisor)
}
}
Ring.java
import java.util.*;
import java.util.regex.*;
public class Ring
implements Comparable {
private static final Pattern RING_LINE = Pattern.compile("^([A-Za-z]+)=((\\d+)(\\.(\\d))?)$")
private static final List RING_NAMES = new ArrayList()
private static int RING_NAME_LENGTH = 0;
private static void addRingName(String name) {
RING_NAMES.add(name)
if (name.length() > RING_NAME_LENGTH) {
RING_NAME_LENGTH = name.length()
}
}
private String name;
private Fraction cl;
public Ring(String line) {
Matcher matcher = RING_LINE.matcher(line)
if (matcher.find() == false) {
throw new IllegalArgumentException(line + " not of the format=")
}
this.name = matcher.group(1)
String clMajor = matcher.group(3)
int cl = 0;
try {
cl = 10 * Integer.parseInt(clMajor)
} catch(NumberFormatException e) {
throw new IllegalArgumentException(line + " not of the format=")
}
String clMinor = matcher.group(5)
if (clMinor != null) {
try {
cl += Integer.parseInt(clMinor)
} catch(NumberFormatException e) {
throw new IllegalArgumentException(line + " not of the format=")
}
}
this.cl = new Fraction(cl, 10)
addRingName(this.name)
}
public Ring(String name,
Fraction cl) {
this.name = name;
this.cl = cl;
addRingName(this.name)
}
public String name() {
return name;
}
public String displayName() {
String display = name;
while (display.length() < RING_NAME_LENGTH) {
display += " ";
}
return display;
}
public Fraction cl() {
return cl;
}
public void setCl(int newValue) {
this.cl = new Fraction(newValue, 1)
}
public int orbs() {
int major = (int) Math.floor(cl.value())
int minor = (int) ((cl.value() - major) * 10)
return minor * major + 5 * major * (major - 1)
}
public int compareTo(Ring ring) {
int fractionCompare = cl.compareTo(ring.cl())
if (fractionCompare == 0) {
int myIndex = RING_NAMES.indexOf(name)
int theirIndex = RING_NAMES.indexOf(ring.name())
return theirIndex - myIndex;
}
return fractionCompare;
}
}
import java.util.regex.*;
public class Ring
implements Comparable
private static final Pattern RING_LINE = Pattern.compile("^([A-Za-z]+)=((\\d+)(\\.(\\d))?)$")
private static final List
private static int RING_NAME_LENGTH = 0;
private static void addRingName(String name) {
RING_NAMES.add(name)
if (name.length() > RING_NAME_LENGTH) {
RING_NAME_LENGTH = name.length()
}
}
private String name;
private Fraction cl;
public Ring(String line) {
Matcher matcher = RING_LINE.matcher(line)
if (matcher.find() == false) {
throw new IllegalArgumentException(line + " not of the format
}
this.name = matcher.group(1)
String clMajor = matcher.group(3)
int cl = 0;
try {
cl = 10 * Integer.parseInt(clMajor)
} catch(NumberFormatException e) {
throw new IllegalArgumentException(line + " not of the format
}
String clMinor = matcher.group(5)
if (clMinor != null) {
try {
cl += Integer.parseInt(clMinor)
} catch(NumberFormatException e) {
throw new IllegalArgumentException(line + " not of the format
}
}
this.cl = new Fraction(cl, 10)
addRingName(this.name)
}
public Ring(String name,
Fraction cl) {
this.name = name;
this.cl = cl;
addRingName(this.name)
}
public String name() {
return name;
}
public String displayName() {
String display = name;
while (display.length() < RING_NAME_LENGTH) {
display += " ";
}
return display;
}
public Fraction cl() {
return cl;
}
public void setCl(int newValue) {
this.cl = new Fraction(newValue, 1)
}
public int orbs() {
int major = (int) Math.floor(cl.value())
int minor = (int) ((cl.value() - major) * 10)
return minor * major + 5 * major * (major - 1)
}
public int compareTo(Ring ring) {
int fractionCompare = cl.compareTo(ring.cl())
if (fractionCompare == 0) {
int myIndex = RING_NAMES.indexOf(name)
int theirIndex = RING_NAMES.indexOf(ring.name())
return theirIndex - myIndex;
}
return fractionCompare;
}
}
Rings.java
import java.util.*;
import java.util.regex.*;
public class Rings {
private TreeSet rings = new TreeSet()
public void addRing(String line) {
if (rings.size() == 8) {
throw new IllegalArgumentException("Too many rings ; only 8 allowed")
}
rings.add(new Ring(line))
}
public Fraction overallCl() {
Fraction value = new Fraction(0, 1)
long multiplier = 1;
for (int i = 0; i < 8 - rings.size() i++) {
value = value.add(new Fraction(multiplier++, 1))
}
for (Ring ring : rings) {
Fraction multi = new Fraction(multiplier++, 1)
multi = multi.multiply(ring.cl())
value = value.add(multi)
}
return value.divide(new Fraction(36, 1))
}
public double overallClDouble() {
double value = overallCl().value() * 10;
return Math.round(value) / 10.0;
}
public Map getRingWeights() {
Map toReturn = new HashMap()
int multiplier = 9 - rings.size()
for (Ring ring : rings) {
toReturn.put(ring, multiplier++)
}
return toReturn;
}
public Ring lowest() {
return rings.first()
}
public void reorder() {
TreeSet newRings = new TreeSet()
newRings.addAll(rings)
rings = newRings;
}
public int totalOrbs() {
int orbs = 0;
for (Ring ring : rings) {
orbs += ring.orbs()
}
return orbs;
}
public void addRings(Collection addTo) {
addTo.addAll(rings)
}
public int size() {
return rings.size()
}
public static void main(String[] args) {
Rings rings = new Rings()
for (String arg : args) {
if (arg.indexOf("=") == -1) {
char random = (char)('a' + rings.size())
arg = random + "=" + arg;
}
rings.addRing(arg)
}
System.out.println("Overall CL: " + rings.overallClDouble())
System.out.println(" (Exact value: " + rings.overallCl() + ")")
System.out.println("Total orbs: " + rings.totalOrbs())
}
}
import java.util.regex.*;
public class Rings {
private TreeSet
public void addRing(String line) {
if (rings.size() == 8) {
throw new IllegalArgumentException("Too many rings ; only 8 allowed")
}
rings.add(new Ring(line))
}
public Fraction overallCl() {
Fraction value = new Fraction(0, 1)
long multiplier = 1;
for (int i = 0; i < 8 - rings.size() i++) {
value = value.add(new Fraction(multiplier++, 1))
}
for (Ring ring : rings) {
Fraction multi = new Fraction(multiplier++, 1)
multi = multi.multiply(ring.cl())
value = value.add(multi)
}
return value.divide(new Fraction(36, 1))
}
public double overallClDouble() {
double value = overallCl().value() * 10;
return Math.round(value) / 10.0;
}
public Map
Map
int multiplier = 9 - rings.size()
for (Ring ring : rings) {
toReturn.put(ring, multiplier++)
}
return toReturn;
}
public Ring lowest() {
return rings.first()
}
public void reorder() {
TreeSet
newRings.addAll(rings)
rings = newRings;
}
public int totalOrbs() {
int orbs = 0;
for (Ring ring : rings) {
orbs += ring.orbs()
}
return orbs;
}
public void addRings(Collection
addTo.addAll(rings)
}
public int size() {
return rings.size()
}
public static void main(String[] args) {
Rings rings = new Rings()
for (String arg : args) {
if (arg.indexOf("=") == -1) {
char random = (char)('a' + rings.size())
arg = random + "=" + arg;
}
rings.addRing(arg)
}
System.out.println("Overall CL: " + rings.overallClDouble())
System.out.println(" (Exact value: " + rings.overallCl() + ")")
System.out.println("Total orbs: " + rings.totalOrbs())
}
}
Planner.java
import java.util.*;
public class Planner {
public static void main(String[] args) {
Rings rings = new Rings()
for (String arg : args) {
if (arg.indexOf("=") > -1) {
rings.addRing(arg)
}
}
plan(rings)
}
public static void plan(Rings rings) {
System.out.println("Start status: " + status(rings))
while (ringsToLevel(rings)) {
Ring ring = findRingToLevel(rings)
double cl = levelRing(ring)
String level = "" + cl;
if (cl < 10.0) {
level = " " + level;
}
System.out.println(ring.displayName() + " raised to CL " + level +
" (" + status(rings) + ")")
}
}
public static String status(Rings rings) {
rings.reorder()
double overallCl = rings.overallClDouble()
String overall = "" + overallCl;
if (overallCl < 10.0) {
overall = " " + overall;
}
String totalOrbs = "" + rings.totalOrbs()
while (totalOrbs.length() < 4) {
totalOrbs = " " + totalOrbs;
}
return "Overall CL: " + overall +
", Total Orbs: " + totalOrbs;
}
public static boolean ringsToLevel(Rings rings) {
return rings.lowest().cl().value() < 10.0;
}
public static Ring findRingToLevel(Rings rings) {
TreeSet order = new TreeSet(new CandidatePicker(rings))
rings.addRings(order)
Ring chosenOne = order.last()
while (chosenOne.cl().value() == 10.0) {
order.remove(chosenOne)
chosenOne = order.last()
}
return chosenOne;
}
public static double levelRing(Ring ring) {
int newCl = (int) Math.floor(ring.cl().value() + 1)
ring.setCl(newCl)
return newCl;
}
public static class CandidatePicker
implements Comparator {
private Map weights;
public CandidatePicker(Rings rings) {
this.weights = rings.getRingWeights()
}
public boolean equals(Object object) {
return (object instanceof CandidatePicker)
}
public int compare(Ring ring1,
Ring ring2) {
long orbs1 = (long) Math.floor(ring1.cl().value())
long orbs2 = (long) Math.floor(ring2.cl().value())
long weight1 = weights.get(ring1)
long weight2 = weights.get(ring2)
Fraction fraction1 = new Fraction(weight1, orbs1)
Fraction fraction2 = new Fraction(weight2, orbs2)
if (fraction1.equals(fraction2) == false) {
return fraction1.compareTo(fraction2)
}
return ring1.compareTo(ring2)
}
}
}
public class Planner {
public static void main(String[] args) {
Rings rings = new Rings()
for (String arg : args) {
if (arg.indexOf("=") > -1) {
rings.addRing(arg)
}
}
plan(rings)
}
public static void plan(Rings rings) {
System.out.println("Start status: " + status(rings))
while (ringsToLevel(rings)) {
Ring ring = findRingToLevel(rings)
double cl = levelRing(ring)
String level = "" + cl;
if (cl < 10.0) {
level = " " + level;
}
System.out.println(ring.displayName() + " raised to CL " + level +
" (" + status(rings) + ")")
}
}
public static String status(Rings rings) {
rings.reorder()
double overallCl = rings.overallClDouble()
String overall = "" + overallCl;
if (overallCl < 10.0) {
overall = " " + overall;
}
String totalOrbs = "" + rings.totalOrbs()
while (totalOrbs.length() < 4) {
totalOrbs = " " + totalOrbs;
}
return "Overall CL: " + overall +
", Total Orbs: " + totalOrbs;
}
public static boolean ringsToLevel(Rings rings) {
return rings.lowest().cl().value() < 10.0;
}
public static Ring findRingToLevel(Rings rings) {
TreeSet
rings.addRings(order)
Ring chosenOne = order.last()
while (chosenOne.cl().value() == 10.0) {
order.remove(chosenOne)
chosenOne = order.last()
}
return chosenOne;
}
public static double levelRing(Ring ring) {
int newCl = (int) Math.floor(ring.cl().value() + 1)
ring.setCl(newCl)
return newCl;
}
public static class CandidatePicker
implements Comparator
private Map
public CandidatePicker(Rings rings) {
this.weights = rings.getRingWeights()
}
public boolean equals(Object object) {
return (object instanceof CandidatePicker)
}
public int compare(Ring ring1,
Ring ring2) {
long orbs1 = (long) Math.floor(ring1.cl().value())
long orbs2 = (long) Math.floor(ring2.cl().value())
long weight1 = weights.get(ring1)
long weight2 = weights.get(ring2)
Fraction fraction1 = new Fraction(weight1, orbs1)
Fraction fraction2 = new Fraction(weight2, orbs2)
if (fraction1.equals(fraction2) == false) {
return fraction1.compareTo(fraction2)
}
return ring1.compareTo(ring2)
}
}
}