Skip to content

Commit

Permalink
script that compiles the program and tests it
Browse files Browse the repository at this point in the history
  • Loading branch information
priitkalda committed Nov 9, 2015
1 parent 5c6ded5 commit c1233e8
Show file tree
Hide file tree
Showing 43 changed files with 410 additions and 143 deletions.
1 change: 1 addition & 0 deletions levels/levels.dat.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8|1920|800|parkla.png|5|3
76 changes: 71 additions & 5 deletions levels/levels2.dat

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions levels/levels2.dat.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8|1920|800|parkla2.png|8|4
120 changes: 120 additions & 0 deletions levels/levels3.dat

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions levels/levels3.dat.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8|600|800|parkla3.png|7|3
6 changes: 6 additions & 0 deletions maven_thingy.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
call mvn package
java -cp target/PSP-1.0.jar application.Main levels/levels.dat 400
java -cp target/PSP-1.0.jar application.Main levels/levels2.dat 218
java -cp target/PSP-1.0.jar application.Main levels/levels3.dat 203
call mvn clean
pause
Binary file added parkla3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>PSP</groupId>
<artifactId>PSP</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.0</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
Expand All @@ -18,8 +18,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
Expand Down
Binary file added runnable_test_build_4.jar
Binary file not shown.
57 changes: 12 additions & 45 deletions src/application/Algorithm.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import java.util.ArrayList;
import java.util.Date;

import javafx.scene.layout.GridPane;

public class Algorithm implements Runnable{

static int gateX = 0;
Expand Down Expand Up @@ -241,54 +243,16 @@ else if(right.length() < left.length()){
private static void createParkingSpot(int x, int y){
//ParkingSpotManager.add(new ParkingSpot(x, y, null, null, null, null));
//colorOccupied(x, y);
Main.colorParking(x, y, Main.level2);
colorParking(x, y);
}


public static void colorParking(int x, int y){
Main.colorParking(x, y, Main.level2);
}

public static void colorOccupied(int x, int y){
for(int i = 0; i< pl; i++){
for(int j = 0; j< pk; j++){
if (i==0&&j==0){
Main.replace_block(14, x+i, y+j, Main.level2);
}
else if (i==0&&j==pk-1){
Main.replace_block(17, x+i, y+j, Main.level2);
}
else if (i==pl-1&&j==0){
Main.replace_block(15, x+i, y+j, Main.level2);
}
else if (i==pl-1&&j==pk-1){
Main.replace_block(16, x+i, y+j, Main.level2);
}
else if (i==1 && j == 0){
Main.replace_block(18, x+i, y+j, Main.level2);
}
else if (i==2 && j == 0){
Main.replace_block(19, x+i, y+j, Main.level2);
}
else if (i==3 && j == 0){
Main.replace_block(20, x+i, y+j, Main.level2);
}
else if (i==0 && j == 1){
Main.replace_block(21, x+i, y+j, Main.level2);
}
else if (i==pl-1 && j == 1){
Main.replace_block(23, x+i, y+j, Main.level2);

}
else if (i==1 && j == pk-1){
Main.replace_block(24, x+i, y+j, Main.level2);
}
else if (i==2 && j == pk-1){
Main.replace_block(25, x+i, y+j, Main.level2);
}
else if (i==3 && j == pk-1){
Main.replace_block(26, x+i, y+j, Main.level2);
}
else{
Main.replace_block(22, x+i, y+j, Main.level2);
}
}
}
Main.colorOccupied(x, y, Main.level2);
}

/**
Expand Down Expand Up @@ -325,6 +289,9 @@ public static boolean containsAll(int x, int y, int type){
if(Main.getType(x+i, y+j) != type){
return false;
}
// if(!Block.isMoveable( Main.getType(x+i, y+j) )){
// return false;
// }
}
}
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/application/Animation.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class Animation implements Runnable {

protected static int numberOfCarsIn = 10;
protected static int numberOfCarsOut = 10;
protected static int botSpeed = 200;
protected static int botSpeed = 200; //1,6
protected static int numberOfbots = 4;

public static boolean paused = false;
Expand All @@ -20,7 +20,7 @@ public void run(){
while(kas){

if (!r2.isBusy){
Algorithm.colorOccupied((int)r2.get_X(), (int)r2.get_Y());
Algorithm.colorOccupied(r2.getRobotX(), r2.getRobotY());
kas=false;
}
System.out.println("tere");
Expand All @@ -43,7 +43,7 @@ public void run(){
while(kas){

if (!r2.isBusy){
Algorithm.colorOccupied((int)r2.get_X(), (int)r2.get_Y());
Algorithm.colorOccupied((int)r2.getRobotX(), (int)r2.getRobotY());
kas=false;
}
System.out.println("tere");
Expand Down
5 changes: 3 additions & 2 deletions src/application/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class Block extends Rectangle {
public void muuda(int pos){
if (this.nr != 6){
this.nr = pos;

this.setFill(textures[pos]);
this.see = textures[pos];

Expand All @@ -77,12 +78,12 @@ public void muuda(int pos){
}


public boolean isMoveable(){
int n = this.nr;
public static boolean isMoveable(int n){
if (
n == _PARKING_P||
n == _NO_BLOCK||
n == _ROBOT_ROAD||
n == _ROBOT_GATEWAY||
n == _PARKING_TOP_LEFT||
n == _PARKING_TOP_RIGHT||
n == _PARKING_BOT_RIGHT||
Expand Down
64 changes: 10 additions & 54 deletions src/application/Bot.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,69 +28,25 @@ public Bot(double arg0, double arg1, double arg2, double arg3) {
}


public double get_X() {
return this.x/Block.suurus;
public int getRobotX() {
return (int)this.x/Block.suurus;
}

public double get_Y() {
return this.y/Block.suurus;
public int getRobotY() {
return (int)this.y/Block.suurus;
}

public void toggleColor(){
if (!this.isBusy){
System.out.println("[Understood] Respraying. I am here: ("+this.x/Block.suurus + ", "+this.y/Block.suurus +")");
this.isBusy=true;

Main.replace_block(0, (int)this.x/Block.suurus, (int)this.y/Block.suurus, Main.level2);


boolean pTäht = false;

int iks = (int)this.x/Block.suurus;
int igr = (int)this.y/Block.suurus;

for(int i = 0; i< Main.pencil_width; i++){
for(int j = 0; j< Main.pencil_height; j++){

if (i==0&&j==0){
Main.replace_block(Block._PARKING_TOP_LEFT, iks+i, igr+j, Main.level2);
}
else if (i==0&&j==Main.pencil_height-1){
Main.replace_block(Block._PARKING_BOT_LEFT, iks+i, igr+j, Main.level2);
}
else if (i==Main.pencil_width-1&&j==0){
Main.replace_block(Block._PARKING_TOP_RIGHT, iks+i, igr+j, Main.level2);
}
else if (i==Main.pencil_width-1&&j==Main.pencil_height-1){
Main.replace_block(Block._PARKING_BOT_RIGHT, iks+i, igr+j, Main.level2);
}

else if (i==0|| i==Main.pencil_width-1){
Main.replace_block(Block._PARKING_BORDER_SIDE, iks+i, igr+j, Main.level2);
}
else if(j==0||j==Main.pencil_height-1){
Main.replace_block(Block._PARKING_BORDER_TOPBOT, iks+i, igr+j, Main.level2);
}
else if (!pTäht){
pTäht=true;
Main.replace_block(Block._PARKING_P, iks+i, igr+j, Main.level2);
}
else{
Main.replace_block(Block._PARKING_FILLED_BLUE, iks+i, igr+j, Main.level2);
}


}
}



// if(this.getFill()==Plokk.textures[49]){
// this.setFill(Plokk.textures[48]);
// }
// else{
// this.setFill(Plokk.textures[49]);
// }
if(this.getFill()==Block.textures[49]){
this.setFill(Block.textures[48]);
}
else{
this.setFill(Block.textures[49]);
}
this.isBusy=false;
if (!this.orders_comm.isEmpty()){
String k = this.orders_comm.poll();
Expand Down
Loading

0 comments on commit c1233e8

Please sign in to comment.