6..7 lines in PredatorPreySimulation, SegregationSimulation
PredatorPreySimulation /cellsociety_team19/src/model/PredatorPreySimulation.java |
SegregationSimulation /cellsociety_team19/src/model/SegregationSimulation.java |
public void initSimulation() { double percentEmptyCells = Double.parseDouble(ConfigurationLoader.getConfig().getCustomParam("percentEmpty")); double percentShark = Double.parseDouble(ConfigurationLoader.getConfig().getCustomParam("percentShark")); createGrid(percentEmptyCells, percentShark); }
|
public void initSimulation() { myProbability = Double.parseDouble(ConfigurationLoader.getConfig().getCustomParam("probability")); myMovingCells = new ArrayList<Cell>(); double percentEmptyCells = Double.parseDouble(ConfigurationLoader.getConfig().getCustomParam("percentEmpty")); double percenttypeA = Double.parseDouble(ConfigurationLoader.getConfig().getCustomParam("percentTypeA")); createGrid(percentEmptyCells, percenttypeA); }
|
12 lines in FireSimulation, SegregationSimulation
SegregationSimulation /cellsociety_team19/src/model/SegregationSimulation.java |
FireSimulation /cellsociety_team19/src/model/FireSimulation.java |
@Override public void updateGrid(){ updateFutureStates(); Cell[][] myGrid = this.getGrid(); for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) { Cell currentCell = myGrid[i][j]; currentCell.setCurrentstate(currentCell.getFuturestate()); } } }
|
@Override public void updateGrid() { probOfBurning = Double.parseDouble(ConfigurationLoader.getConfig().getCustomParam("probability")); Cell[][] myGrid = getGrid(); updateFutureStates(); for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) { Cell currentCell = myGrid[i][j]; currentCell.setCurrentstate(currentCell.getFuturestate()); } } }
|
5 lines in FireSimulation, GameOfLifeSimulation
FireSimulation /cellsociety_team19/src/model/FireSimulation.java |
GameOfLifeSimulation /cellsociety_team19/src/model/GameOfLifeSimulation.java |
public void createGrid() { Cell[][] myGrid = getGrid(); generator = new Random(); for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) {
|
public void printGrid(){ Random generator = new Random(); Cell[][] myGrid = getGrid(); for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) {
|
2 lines in CellGrid, PredatorPreySimulation
CellGrid /cellsociety_team19/src/model/CellGrid.java |
PredatorPreySimulation /cellsociety_team19/src/model/PredatorPreySimulation.java |
for(int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) {
|
for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) {
|
6..10 lines in FireSimulation, GameOfLifeSimulation
FireSimulation /cellsociety_team19/src/model/FireSimulation.java |
GameOfLifeSimulation /cellsociety_team19/src/model/GameOfLifeSimulation.java |
String myState = myCell.getCurrentstate(); ArrayList<Cell> currentNeighbors = getNeighbors(myCell); if(myState.equals(BURNING)){ myCell.setFuturestate(EMPTY); } else if(myState.equals(TREE)){
|
String myState = myCell.getCurrentstate(); //ArrayList<RectangleWithDiagonals> currentNeighbors = myCell.getNeighbors(myCell, myGrid); //ArrayList<RectangleWithDiagonals> currentNeighbors = getNeighbors(myCell); ArrayList<Cell> currentNeighbors = getNeighbors(myCell); int liveCount = countCellsOfState(currentNeighbors, ALIVE); if(myState.equals(DEAD)){ if(liveCount == 3){ myCell.setFuturestate(ALIVE); } else{
|
10..11 lines in PredatorPreySimulation (x2)
PredatorPreySimulation /cellsociety_team19/src/model/PredatorPreySimulation.java |
PredatorPreySimulation /cellsociety_team19/src/model/PredatorPreySimulation.java |
private ArrayList<Cell> getAvailableCells(Cell myCreature) { ArrayList<Cell> neighbors = getNeighbors(myCreature); ArrayList<Cell> availableCells = new ArrayList<Cell>(); for (Cell neighbor : neighbors) { if (neighbor.getCurrentstate().equals(EMPTY) && !neighbor.getFuturestate().equals(myCreature.getCurrentstate())){ availableCells.add(neighbor); } } return availableCells; }
|
private ArrayList<Cell> getFishNeighbors(Cell myShark) { ArrayList<Cell> neighbors = getNeighbors(myShark); ArrayList<Cell> myFishFriends = new ArrayList<Cell>(); for (Cell neighbor : neighbors) { if (neighbor.getCurrentstate().equals(FISH) && neighbor.getFuturestate().equals("")) { myFishFriends.add(neighbor); } } return myFishFriends; }
|
4..8 lines in SliderCreator (x2)
SliderCreator /cellsociety_team19/src/view/SliderCreator.java |
SliderCreator /cellsociety_team19/src/view/SliderCreator.java |
reset = false; hbox = new HBox(10); Label lbl = new Label(String.valueOf(defaultVal)); Label display = new Label(displayName);
|
reset = false; double defaultValue = Double.parseDouble(ConfigurationLoader.getConfig().getCustomParam(text)); // TODO: Jordan: Fix dimensions on this piece of shit hbox = new HBox(10); Label lbl = new Label(String.valueOf(defaultValue * 100)); Label displayName = new Label(text);
|
6 lines in PredatorPreySimulation, GameOfLifeSimulation
PredatorPreySimulation /cellsociety_team19/src/model/PredatorPreySimulation.java |
GameOfLifeSimulation /cellsociety_team19/src/model/GameOfLifeSimulation.java |
@Override public void updateGrid(){ Cell[][] myGrid = getGrid(); updateFutureStates(); for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) {
|
@Override public void updateGrid(){ Cell[][] myGrid = getGrid(); updateFutureStates(); for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) {
|
13 lines in SegregationSimulation, GameOfLifeSimulation
GameOfLifeSimulation /cellsociety_team19/src/model/GameOfLifeSimulation.java |
SegregationSimulation /cellsociety_team19/src/model/SegregationSimulation.java |
for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) { myGrid[i][j] = new RectangleWithDiagonals(i, j); if(initialization.size() == 0){ myGrid[i][j].setCurrentstate(DEAD); } else{ int cellChoice = generator.nextInt(initialization.size()); myGrid[i][j].setCurrentstate(initialization.get(cellChoice)); initialization.remove(cellChoice); } } }
|
for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) { myGrid[i][j] = new RectangleWithDiagonals(i, j); if(initialization.size() == 0){ myGrid[i][j].setCurrentstate(EMPTY); } else{ int cellChoice = generator.nextInt(initialization.size()); myGrid[i][j].setCurrentstate(initialization.get(cellChoice)); initialization.remove(cellChoice); } } }
|
4 lines in FireSimulation, GameOfLifeSimulation
GameOfLifeSimulation /cellsociety_team19/src/model/GameOfLifeSimulation.java |
FireSimulation /cellsociety_team19/src/model/FireSimulation.java |
public void updateFutureStates(){ Cell[][] myGrid = getGrid(); for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) {
|
private void updateFutureStates(){ Cell[][] myGrid = getGrid(); for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) {
|
14 lines in PredatorPreySimulation, SegregationSimulation
PredatorPreySimulation /cellsociety_team19/src/model/PredatorPreySimulation.java |
SegregationSimulation /cellsociety_team19/src/model/SegregationSimulation.java |
int size = getNumRows()*getNumCols(); double numEmpty = percentEmptyCells*size; double numShark = percentShark*(size-numEmpty); double numFish = size-numEmpty-numShark; ArrayList<String> initialization = new ArrayList<String>(); for(int i = 0; i<numEmpty; i++){ initialization.add(EMPTY); } for(int i = 0; i<numShark; i++){ initialization.add(SHARK); } for(int i = 0; i<numFish; i++){ initialization.add(FISH); }
|
int size = getNumRows()*getNumCols(); double numEmpty = percentEmpty*size; double numtypeA = percenttypeA*(size-numEmpty); double numtypeB = size-numEmpty-numtypeA; ArrayList<String> initialization = new ArrayList<String>(); for(int i = 0; i<numEmpty; i++){ initialization.add(EMPTY); } for(int i = 0; i<numtypeA; i++){ initialization.add(typeA); } for(int i = 0; i<numtypeB; i++){ initialization.add(typeB); }
|
14 lines in MainView (x2)
MainView /cellsociety_team19/src/view/MainView.java |
MainView /cellsociety_team19/src/view/MainView.java |
private void setColumnsEventHandler(Slider sizeSlider) { sizeSlider.valueProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { gameloop.pause(); double newval = (double) newValue; ConfigurationLoader.getConfig().setNumCols((int) newval); createCellPane(); createCustomButtons(); createSimulation(); } }); }
|
private void setRowsEventHandler(Slider sizeSlider) { sizeSlider.valueProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { gameloop.pause(); double newval = (double) newValue; ConfigurationLoader.getConfig().setNumRows((int) newval); createCellPane(); createCustomButtons(); createSimulation(); } }); }
|
8 lines in PredatorPreySimulation, SegregationSimulation
SegregationSimulation /cellsociety_team19/src/model/SegregationSimulation.java |
PredatorPreySimulation /cellsociety_team19/src/model/PredatorPreySimulation.java |
for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) { Cell currentCell = myGrid[i][j]; if(!currentCell.getCurrentstate().equals(EMPTY)){ updateCell(currentCell); } } }
|
for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) { Cell currentCell = myGrid[i][j]; if(!currentCell.getCurrentstate().equals(SHARK)){ updateCell(currentCell); } } }
|
4 lines in PredatorPreySimulation, SegregationSimulation
PredatorPreySimulation /cellsociety_team19/src/model/PredatorPreySimulation.java |
SegregationSimulation /cellsociety_team19/src/model/SegregationSimulation.java |
for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) { Cell currentCell = myGrid[i][j]; if(currentCell.getCurrentstate().equals(SHARK)){
|
for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) { Cell currentCell = myGrid[i][j]; if(currentCell.getCurrentstate().equals(EMPTY)){
|
1 line in RectangleWithDiagonals, Rectangle
Rectangle /cellsociety_team19/src/model/Rectangle.java |
RectangleWithDiagonals /cellsociety_team19/src/model/RectangleWithDiagonals.java |
private int[] rowDeltas = { -1, 0, 1, 0, 1, 1, -1, -1 };
|
private int[] rowDeltas = {-1, 0, 1, 0, 1, 1, -1, -1};
|
1 line in RectangleWithDiagonals, Rectangle
RectangleWithDiagonals /cellsociety_team19/src/model/RectangleWithDiagonals.java |
Rectangle /cellsociety_team19/src/model/Rectangle.java |
private int[] colDeltas = {0, -1, 0, 1, 1, -1, 1, -1};
|
private int[] colDeltas = { 0, -1, 0, 1, 1, -1, 1, -1 };
|