Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan19 committed Sep 16, 2018
1 parent 1b9fc01 commit bafe745
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/main/java/discord/TwoDee.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logic.CommandHandler;
import org.javacord.api.DiscordApiBuilder;
import org.javacord.api.entity.message.MessageBuilder;
import org.javacord.api.entity.user.User;
import org.javacord.api.util.logging.ExceptionLogger;

import java.io.BufferedReader;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/logic/DiceRoller.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ private EmbedBuilder buildResultEmbed(MessageAuthor author, ArrayList<Integer> d
.setTitle(TwoDee.getRollTitleMessage())
.setAuthor(author)
.setColor(new Color(random.nextFloat(), random.nextFloat(), random.nextFloat()))
.addField("Regular dice", formatResults(diceResults, author), true)
.addField("Regular dice", formatResults(diceResults), true)
.addField("Picked", replaceBrackets(topTwo.toString()), true)
.addField("Dropped", replaceBrackets(dropped.toString()), true)
.addField("Plot dice", replaceBrackets(pdResults.toString()), true)
.addField("Total", String.valueOf(total), true);
}

//Bold 1s to show total doom generated. Runs doom increasing method afterwards.
private String formatResults(ArrayList<Integer> s, MessageAuthor author) {
private String formatResults(ArrayList<Integer> s) {
String resultString = "";
if (s.size() > 1){
for (int i = 0; i < s.size() - 1; i++){
Expand Down
14 changes: 0 additions & 14 deletions src/main/java/logic/StatisticsGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,6 @@ public StatisticsGenerator(String message) {
doomMap = generateProbabilityHash(diceList, plotDice, doomHash);
}

private void addToPool(String argCopy, String numDice, ArrayList<Integer> pool) {
//Remove all letters so only numbers remain to get the dice value
int diceVal = Integer.parseInt(argCopy.replaceAll("[a-zA-Z]", ""));

//If there are multiple dice being rolled, add all of them to the pool. Otherwise, only add one.
if (numDice.equals("")) {
pool.add(diceVal);
} else {
for (int i = 0; i < Integer.parseInt(numDice); i++) {
pool.add(diceVal);
}
}
}

//Generate a HashMap with the roll as the keys and the percent as the values
private HashMap<Integer,Double> generateProbabilityHash(ArrayList<Integer> diceList, ArrayList<Integer> plotDice, HashMap<Integer, Integer> resultHash) {
int totalCombos = getTotalCombos(diceList, plotDice);
Expand Down

0 comments on commit bafe745

Please sign in to comment.