This commit is contained in:
2018-05-24 16:42:54 +02:00
parent 91899be62c
commit ecd65207ac
6 changed files with 18 additions and 32 deletions

View File

@@ -33,6 +33,19 @@ public class Program {
proc.forEach(p -> procMap.put(p.getName(), p.getBody()));
}
public Worm getWorm() {
return this.worm;
}
public Map<String, Object> getVariables() {
return this.varMap;
}
protected void setWorm(Worm worm) {
this.worm = worm;
}
protected void setActionHandler(IActionHandler actionHandler) {
this.actionHandler = actionHandler;
}
protected void execute() {
enoughAP = true;
@@ -226,21 +239,10 @@ public class Program {
}
protected void setActionHandler(IActionHandler actionHandler) {
this.actionHandler = actionHandler;
}
public Worm getWorm() {
return this.worm;
}
protected void setWorm(Worm worm) {
this.worm = worm;
}
public Map<String, Object> getVariables() {
return this.varMap;
}
private class CallStackNode {
private Iterator<Statement> statementIterator;

View File

@@ -59,7 +59,7 @@ public abstract class Projectile extends GameObject implements IJumpable {
* |result == orientation
*/
public double getOrientation() {
return orientation;
return this.orientation;
}
private final double orientation;
@@ -159,7 +159,6 @@ public abstract class Projectile extends GameObject implements IJumpable {
* | List<Worm> worms = getWorld().getGameObjectsByClass(Worm.class)
* |for (Worm worm: worms)
* | if (this.getDistance(worm) < 0)
* | setLocation(newLocation)
* | hit(worm)
*
* @throws IllegalStateException ...
@@ -189,7 +188,6 @@ public abstract class Projectile extends GameObject implements IJumpable {
for (Worm worm: worms) {
if (this.getDistance(worm) < 0) {
setLocation(newLocation);
hit(worm);
}
}
@@ -273,7 +271,7 @@ public abstract class Projectile extends GameObject implements IJumpable {
/**
* @return ...
* result == getOrientation() < PI
* |result == getOrientation() < PI
*/
private boolean canJump() {
return getOrientation() < PI;

View File

@@ -497,7 +497,6 @@ public class World {
* @return ...
* |result == getGameObjectsByClass(Worm.class)
*/
@SuppressWarnings("unchecked")
public List<Worm> getWormList() {
return getGameObjectsByClass(Worm.class);
@@ -507,7 +506,6 @@ public class World {
* @return ...
* |result == getGameObjectsByClass(Food.class)
*/
@SuppressWarnings("unchecked")
public List<Food> getFoodList() {
return getGameObjectsByClass(Food.class);

View File

@@ -804,6 +804,7 @@ public class Worm extends GameObject implements IJumpable{
}
/**
* TODO FIXME
* Decreases the hit points of the attacked worm (chosen by a coin).
*
* @param newLocation The new location of the jumped worm.

View File

@@ -24,19 +24,6 @@ public class ProgramFactory implements IProgramFactory<Expression, Statement, Pr
return new Program(procs, main);
}
// TODO checken of dit moet
// /**
// * Create a program from the given argument.
// *
// * @param main The main statement of the program. Most likely this is a
// * sequence statement.
// * @return A new program without procedure definitions.
// */
// @Override
// public Object createProgram(Object main) throws ModelException {
// return null;
// }
/**
* Create a procedure definition with the given name and body.
*

View File

@@ -35,7 +35,7 @@ public class Tuple<T1, T2> {
* @throws IllegalArgumentException ...
* |
*/
public Tuple(T1 item1, T2 item2) throws IllegalArgumentException {
public Tuple(T1 item1, T2 item2) {
this.item1 = item1;
this.item2 = item2;