Skip to content

Commit a2b9142

Browse files
author
Hattinger04
committed
adding 'blickrichtung'
1 parent afa30b1 commit a2b9142

File tree

14 files changed

+23
-19
lines changed

14 files changed

+23
-19
lines changed

src/main/java/io/github/Hattinger04/hamster/HamsterController.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public class HamsterController {
2828

2929
private Workbench wb = Workbench.getWorkbench();
3030

31-
// TODO: Unterordner / nicht nur eine Datei!
3231
/**
3332
* Creates new File and will create a parent folder if not existing
3433
* It also writes the given program into the file
@@ -96,6 +95,6 @@ public ResponseEntity<?> newTerrain(@RequestBody String json) {
9695
writeTextToFile(new File(hamsterPath), hamster.getProgram());
9796
wb.getJsonObject().clear();
9897
return new ResponseEntity<>(wb.startProgram(hamsterPath, terrainPath,
99-
wb.new TerrainForm(hamster.getLaenge(), hamster.getBreite(), hamster.getCorn(), hamster.getCornAnzahl(), hamster.getWall(), hamster.getX(), hamster.getY())), HttpStatus.OK);
98+
wb.new TerrainForm(hamster.getLaenge(), hamster.getBreite(), hamster.getCorn(), hamster.getCornAnzahl(), hamster.getWall(), hamster.getX(), hamster.getY(), hamster.getBlickrichtung())), HttpStatus.OK);
10099
}
101100
}

src/main/java/io/github/Hattinger04/hamster/model/Hamster.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public Hamster(String program, String programName) {
3232
private String programName;
3333
private String terrainName;
3434
private String program;
35-
private int laenge, breite, x, y;
35+
private int laenge, breite, x, y, blickrichtung;
3636
private int[] cornAnzahl;
3737
private int[][] corn, wall;
3838
}

src/main/java/io/github/Hattinger04/hamsterEvaluation/compiler/controller/CompilerController.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,8 @@ public boolean ensureCompiled(HamsterFile file) {
7272
if (!classFile.exists()
7373
|| file.lastModified() > classFile.lastModified()) {
7474
try {
75-
System.out.println("Ensuring Compiled...");
7675
return this.compilerModel.compile(file); // dibo 15.11.2010
7776
} catch (IOException e) { // dibo 25.10.2011
78-
System.out.println("Compiling error! " + e.getMessage());
7977
}
8078
}
8179
return true;

src/main/java/io/github/Hattinger04/hamsterEvaluation/compiler/model/CompilerModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public boolean compile(HamsterFile file) throws IOException {
6262
return true;
6363
}
6464
for(Object o : compilerErrors) {
65-
System.out.println("Compiler Error: " + o.toString());
65+
// System.out.println("Compiler Error: " + o.toString());
6666
}
6767
return false;
6868
}

src/main/java/io/github/Hattinger04/hamsterEvaluation/simulation/model/Hamster.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ public int getColor() {
5757
}
5858

5959
public void setXY(int x, int y) {
60-
int oldX = this.x;
61-
int oldY = this.y;
6260
this.x = x;
6361
this.y = y;
6462
}

src/main/java/io/github/Hattinger04/hamsterEvaluation/workbench/Workbench.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ protected Workbench(boolean simulatorOnly, SimulationModel simModel) {
8585
compiler = new CompilerController(model.getCompilerModel(), this);
8686
debugger = new DebuggerController(model.getDebuggerModel(), this);
8787
// Example of how a program could start:
88-
// startProgram("Programme/data.ham", "Programme/test.ter", new TerrainForm(10,10,new int[][] {{1,2}, {2,3}}, new int[] {1,1}, new int[][] {{0,0}, {1,0}}, 0, 1));
88+
// startProgram("Programme/data.ham", "Programme/test.ter", new TerrainForm(10,10,new int[][] {{1,2}, {2,3}}, new int[] {1,1}, new int[][] {{0,0}, {1,0}, 1}, 0, 1));
8989
}
9090

9191
@Getter @Setter
9292
public class TerrainForm {
9393

94-
private int laenge, breite, x, y;
94+
private int laenge, breite, x, y, blickrichtung;
9595
private int[] cornAnzahl;
9696
private int[][] corn, wall;
9797

@@ -106,14 +106,15 @@ public class TerrainForm {
106106
* @param x
107107
* @param y
108108
*/
109-
public TerrainForm(int laenge, int breite, int[][] corn, int[] cornAnzahl, int[][] wall, int x, int y) {
109+
public TerrainForm(int laenge, int breite, int[][] corn, int[] cornAnzahl, int[][] wall, int x, int y, int blickrichtung) {
110110
this.laenge = laenge;
111111
this.breite = breite;
112112
this.corn = corn;
113113
this.cornAnzahl = cornAnzahl;
114114
this.wall = wall;
115115
this.x = x;
116116
this.y = y;
117+
this.blickrichtung = blickrichtung;
117118
}
118119
}
119120

@@ -192,7 +193,6 @@ public Terrain createTerrain(TerrainForm form) {
192193
if(j % 2 == 0) {
193194
save = form.getCorn()[i][j];
194195
} else {
195-
System.out.println(save + " " + form.getCorn()[i][j] + " " + form.getCornAnzahl()[i]);
196196
terrain.setCornCount(save, form.getCorn()[i][j], form.getCornAnzahl()[i]);
197197
}
198198
}
@@ -203,13 +203,13 @@ public Terrain createTerrain(TerrainForm form) {
203203
if(j % 2 == 0) {
204204
save = form.getWall()[i][j];
205205
} else {
206-
System.out.println(save + " " + form.getWall()[i][j]);
207206
terrain.setWall(save, form.getWall()[i][j], true);
208207
}
209208

210209
}
211210
}
212211
terrain.getDefaultHamster().setXY(form.getX(), form.getY());
212+
terrain.getDefaultHamster().setDir(form.getBlickrichtung());
213213
return terrain;
214214
}
215215

src/main/resources/allLogs.log

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,3 +390,5 @@ Okt. 31, 2022 7:45:42 PM io.github.Hattinger04.aop.LogAspect loginLog
390390
FEIN: User(id=null, username=admin, password=admin, active=null, roles=null) - [logged in]
391391
Nov. 01, 2022 8:14:49 PM io.github.Hattinger04.aop.LogAspect loginLog
392392
FEIN: User(id=null, username=admin, password=admin, active=null, roles=null) - [logged in]
393+
Nov. 08, 2022 6:56:47 PM io.github.Hattinger04.aop.LogAspect loginLog
394+
FEIN: User(id=null, username=admin, password=admin, active=null, roles=null) - [logged in]

src/main/resources/hamster/admin/compiler.tmp

Whitespace-only changes.
436 Bytes
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
void main() {vor();}

0 commit comments

Comments
 (0)