Skip to content

Commit

Permalink
still cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
nata1y committed Jun 26, 2019
1 parent 77f3ef9 commit c4e53c4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/main/java/controller/ButtonPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public ButtonPanel(Simulation sim){
grid.add(controller, BorderLayout.CENTER);

this.add(grid);
play();
//play();
}

/**
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/controller/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void setup() {
new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
startSimulations(Integer.parseInt(miners.getText()), Integer.parseInt(pools.getText()), Integer.parseInt(solom.getText()), Integer.parseInt(runs.getText()), 1, 2);
startSimulations(Integer.parseInt(miners.getText()), Integer.parseInt(pools.getText()), Integer.parseInt(solom.getText()), Integer.parseInt(runs.getText()));
setup.dispose();
} catch (RuntimeException ex) {
ex.printStackTrace(System.err);
Expand All @@ -103,13 +103,12 @@ public void actionPerformed(ActionEvent e) {
/**
* Create simulation with given parameters.
*/
public void startSimulations(int amountAgents, int amountPools, int amountSoloM, int amountSim, int bound, int bound2) {
public void startSimulations(int amountAgents, int amountPools, int amountSoloM, int amountSim) {
this.amountAgents = amountAgents;
this.amountPools = amountPools;
this.bound = bound;
this.amountSim = amountSim - 1;

currentSimulation = new Simulation(amountAgents, amountPools, amountSoloM, bound, bound2);
currentSimulation = new Simulation(amountAgents, amountPools, amountSoloM);
currentSimulation.addObserver(this);
window = createAndShowGUI();
}
Expand Down Expand Up @@ -158,12 +157,12 @@ public void update(Observable source, Object arg) {
System.out.println("Convergence Time: " + currentSimulation.getTime());
if(counter > 1){
counter --;
startSimulations(amountAgents, amountPools, amountSoloM, amountSim, bound, b);
startSimulations(amountAgents, amountPools, amountSoloM, amountSim);
} else {
counter = 1;
bound ++;
System.out.println("________ new dist: " + bound);
startSimulations(amountAgents, amountPools, 0, amountSim, bound, b);
//System.out.println("________ new dist: " + bound);
startSimulations(amountAgents, amountPools, 0, amountSim);
}

}
Expand Down
11 changes: 1 addition & 10 deletions src/main/java/controller/TableController.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ static class PoolTableModel extends AbstractTableModel implements TableModelList
"Number of mining members",
"Revenue",
"Number of attacking miners",
"Fee",
"Current revenue density",
"Revenue if no one attack",
"Cuurent revenue for the whole game",
"Revenue for the whole game if noone attack"
};
Expand Down Expand Up @@ -116,14 +113,8 @@ public Object getValueAt(int row, int column) {
case 3:
return pool.getSabotagers().size();
case 4:
return pool.getContributionFees();
case 5:
return pool.getRevenueDensity();
case 6:
return pool.getRevenueDensityIfNooneAttack();
case 7:
return pool.getIncomeWholeGame();
case 8:
case 5:
return pool.getIncomeWholeGameNooneattack();
default:
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/model/Pool.java
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public double calculateExpectedRevenueDensityGeneral(int[] rates){
return res.get(id);
}

/**
/** Hard coded option for 2 pools in the system for debugging purposes
public double calculateExpectedRevenueDensityHardCoded(int[] rates){
Pool p;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/model/Simulation.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class Simulation extends Observable {
*/
private final double revenueForBlock = 100;

public Simulation(int amountMiners, int amountPools, int amountSoloM, int bound, int bound2){
public Simulation(int amountMiners, int amountPools, int amountSoloM){
this.amountMiners = amountMiners;
this.amountPools = amountPools;
this.amountSoloMiners = amountSoloM;
Expand Down

0 comments on commit c4e53c4

Please sign in to comment.