Initial commit

This commit is contained in:
romanschenk37
2022-03-04 09:04:12 +01:00
parent 19b297fb03
commit 16d287e273
35 changed files with 1505 additions and 19 deletions
@@ -0,0 +1,25 @@
package ch.zhaw.pm2.racetrack.given;
import ch.zhaw.pm2.racetrack.PositionVector;
import ch.zhaw.pm2.racetrack.strategy.MoveStrategy;
/**
* This interface specifies stuff we use to test Racetrack for grading. It shall not be altered!
*/
public interface CarSpecification {
void setPosition(PositionVector position);
PositionVector nextPosition();
void accelerate(PositionVector.Direction acceleration);
void move();
void crash();
boolean isCrashed();
void setMoveStrategy(MoveStrategy moveStrategy);
MoveStrategy getMoveStrategy();
}
@@ -0,0 +1,54 @@
package ch.zhaw.pm2.racetrack.given;
import java.io.File;
/**
* This interface specifies stuff we use to test Racetrack for grading. It shall not be altered! <br/>
* It defines how the Game can be configured.
*/
public interface ConfigSpecification {
int MAX_CARS = 9;
File getMoveDirectory();
void setMoveDirectory(File moveDirectory);
File getFollowerDirectory();
void setFollowerDirectory(File followerDirectory);
File getTrackDirectory();
void setTrackDirectory(File trackDirectory);
/**
* Possible Move Strategies selected by the Console to configure the Cars. (This shall not be altered!)
*/
public enum StrategyType {
DO_NOT_MOVE, USER, MOVE_LIST, PATH_FOLLOWER
}
/**
* Possible space types of the grid. (This shall not be altered!)
* The char value is used to parse from the track file and represents
* the space type in the text representation created by toString().
*/
public enum SpaceType {
WALL('#'),
TRACK(' '),
FINISH_UP('^'),
FINISH_DOWN('v'),
FINISH_LEFT('<'),
FINISH_RIGHT('>');
public final char value;
SpaceType(final char c) {
value = c;
}
public char getValue() {
return value;
}
}
}
@@ -0,0 +1,28 @@
package ch.zhaw.pm2.racetrack.given;
import ch.zhaw.pm2.racetrack.PositionVector;
import java.util.List;
/**
* This interface specifies stuff we use to test Racetrack for grading. It shall not be altered!
*/
public interface GameSpecification {
int getCurrentCarIndex();
char getCarId(int carIndex);
PositionVector getCarPosition(int carIndex);
PositionVector getCarVelocity(int carIndex);
int getWinner();
void doCarTurn(PositionVector.Direction acceleration);
void switchToNextActiveCar();
List<PositionVector> calculatePath(PositionVector startPosition, PositionVector endPosition);
boolean willCarCrash(int carIndex, PositionVector position);
}
@@ -0,0 +1,25 @@
package ch.zhaw.pm2.racetrack.given;
import ch.zhaw.pm2.racetrack.Config;
import ch.zhaw.pm2.racetrack.PositionVector;
/**
* This interface specifies stuff we use to test Racetrack for grading. It shall not be altered!
*/
public interface TrackSpecification {
Config.SpaceType getSpaceType(PositionVector position);
int getCarCount();
CarSpecification getCar(int carIndex);
char getCarId(int carIndex);
PositionVector getCarPos(int carIndex);
PositionVector getCarVelocity(int carIndex);
char getCharAtPosition(int y, int x, Config.SpaceType currentSpace);
String toString();
}