Merge branch 'main' of https://gitarero.ecam.fr/guillaume.bonabau/OOP_F1_Project
This commit is contained in:
commit
e87442bc14
|
|
@ -1,2 +0,0 @@
|
|||
1;3;5;8
|
||||
3;5;7;
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
[{"cell": {
|
||||
"value" : 1,
|
||||
"color" : [255,255,66],
|
||||
"conditionCountNear" : [3,5,7],
|
||||
"conditionHighestNear" : [],
|
||||
"ifValue" : 1,
|
||||
"elseValue" : 0
|
||||
}},
|
||||
{"cell": {
|
||||
"value" : 0,
|
||||
"color" : [97, 94, 58],
|
||||
"conditionCountNear" : [1,3,5,8],
|
||||
"conditionHighestNear" : [],
|
||||
"ifValue" : 1,
|
||||
"elseValue" : 0
|
||||
}}
|
||||
]
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
2;3
|
||||
3
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
0;1;2;3;4
|
||||
3
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
package backend;
|
||||
import java.awt.Color;
|
||||
import java.io.FileNotFoundException;
|
||||
|
|
@ -82,7 +83,7 @@ public class Simulator extends Thread {
|
|||
|
||||
|
||||
//Default rule : Survive always, birth never
|
||||
loadRule("OOP_F1_Project\\conwayRule.json");
|
||||
loadRule("ressources\\Rule\\conwayRule.json");
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -99,6 +100,10 @@ public class Simulator extends Thread {
|
|||
return colorArrayList;
|
||||
}
|
||||
|
||||
public ArrayList<ArrayList<Integer>> getColorArrayList(){
|
||||
return colorArrayList;
|
||||
}
|
||||
|
||||
//Should probably stay as is
|
||||
public void run() {
|
||||
int stepCount=0;
|
||||
|
|
|
|||
|
|
@ -66,6 +66,14 @@ public class MyInterface extends JFrame {
|
|||
panelRight.setLayout(new GridLayout(12,1));
|
||||
contentPane.add(panelRight, BorderLayout.EAST);
|
||||
|
||||
JButton btnStop = new JButton("Stop/Reset");
|
||||
btnStop.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
stopSimu();
|
||||
}
|
||||
});
|
||||
panelTop.add(btnStop);
|
||||
|
||||
JButton btnGo = new JButton("Start/Pause");
|
||||
btnGo.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
|
|
@ -134,14 +142,6 @@ public class MyInterface extends JFrame {
|
|||
});
|
||||
panelRight.add(btnLoadRule);
|
||||
|
||||
JButton btnSaveRule = new JButton("Save Rule");
|
||||
btnSaveRule.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
clicSaveRuleToFileButton();
|
||||
}
|
||||
});
|
||||
panelRight.add(btnSaveRule);
|
||||
|
||||
JButton btnLoadAgents = new JButton("Load Agents");
|
||||
btnLoadAgents.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
|
|
@ -205,6 +205,12 @@ public class MyInterface extends JFrame {
|
|||
panelRight.add(clickLabel);
|
||||
clickLabel.setText("click : " + mySimu.clickActionName());
|
||||
}
|
||||
public void stopSimu() {
|
||||
mySimu.togglePause();
|
||||
mySimu = new Simulator(this);
|
||||
panelDraw.setSimu(mySimu);
|
||||
panelDraw.repaint();
|
||||
}
|
||||
|
||||
public void setStepBanner(String s) {
|
||||
stepLabel.setText(s);
|
||||
|
|
@ -350,14 +356,6 @@ public class MyInterface extends JFrame {
|
|||
}
|
||||
}
|
||||
|
||||
public void clicSaveRuleToFileButton() {
|
||||
String fileName=SelectFile();
|
||||
if (fileName.length()>0) {
|
||||
ArrayList<String> content = mySimu.getRule();
|
||||
writeFile(fileName, (String[]) content.toArray());
|
||||
}
|
||||
}
|
||||
|
||||
public void clicSaveAgentsToFileButton() {
|
||||
String fileName=SelectFile();
|
||||
if (fileName.length()>0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue