Skip to content

Commit

Permalink
Did some orginizing/ TODOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Slavrick committed Jan 1, 2021
1 parent fe520d2 commit 0f66982
Show file tree
Hide file tree
Showing 24 changed files with 269 additions and 254 deletions.
5 changes: 0 additions & 5 deletions Documentation/TODO.txt

This file was deleted.

Binary file modified bin/engine/Board.class
Binary file not shown.
Binary file modified bin/engine/CoordFive.class
Binary file not shown.
Binary file modified bin/engine/CoordFour.class
Binary file not shown.
Binary file modified bin/engine/GameState.class
Binary file not shown.
Binary file modified bin/engine/GameStateManager.class
Binary file not shown.
Binary file modified bin/engine/MoveGenerator.class
Binary file not shown.
Binary file modified bin/engine/MoveNotation.class
Binary file not shown.
Binary file modified bin/engine/Timeline.class
Binary file not shown.
Binary file modified bin/fileIO/FENExporter.class
Binary file not shown.
Binary file modified bin/fileIO/FENParser.class
Binary file not shown.
Binary file modified bin/main/Main.class
Binary file not shown.
3 changes: 0 additions & 3 deletions res/Variations/Puzzles/Rook4.FEN.txt

This file was deleted.

64 changes: 32 additions & 32 deletions src/engine/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,6 @@ public int getSquare(CoordFour c) {
return -1;
}

/**
* Gets the color of the piececode that was sent(as defined above in the piece
* enum above).
*
* @param pieceCode integer that matches the enum
* @return true for white false for black and false for empty.
*/
public static boolean getColorBool(int pieceCode) {
if (pieceCode == piece.EMPTY.ordinal()) {
return false;
}
if (pieceCode >= piece.BPAWN.ordinal()) {
return GameState.BLACK;
}
return GameState.WHITE;
}

/**
* Determine whether a coordinate is in bounds
*
Expand All @@ -124,21 +107,6 @@ public boolean isInBounds(CoordFour cf) {
return isInBounds(cf.x, cf.y);
}

/**
* Gets a string representation of the board. this string starts with the 1st
* rank, and each rank is a line of text.
*/
public String toString() {
String temp = "";
for (int x = 0; x < this.width; x++) {
for (int y = 0; y < this.height; y++) {
temp += pieceChars[brd[x][y]];
}
temp += "\n";
}
return temp;
}

/** TODO maybe this should be in the Timeline class?
* Casltes a king on the present board by checking if it is possible and then swapping the pieces.
* @param color the color to swap
Expand Down Expand Up @@ -167,5 +135,37 @@ else if(!side && wqueenSideCastle) {
}
}

/**
* Gets a string representation of the board. this string starts with the 1st
* rank, and each rank is a line of text.
*/
public String toString() {
String temp = "";
for (int x = 0; x < this.width; x++) {
for (int y = 0; y < this.height; y++) {
temp += pieceChars[brd[x][y]];
}
temp += "\n";
}
return temp;
}

/**
* Gets the color of the piececode that was sent(as defined above in the piece
* enum above).
*
* @param pieceCode integer that matches the enum
* @return true for white false for black and false for empty.
*/
public static boolean getColorBool(int pieceCode) {
if (pieceCode == piece.EMPTY.ordinal()) {
return false;
}
if (pieceCode >= piece.BPAWN.ordinal()) {
return GameState.BLACK;
}
return GameState.WHITE;
}


}
8 changes: 4 additions & 4 deletions src/engine/CoordFive.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ public CoordFive(int x, int y, int T, int L, boolean color) {
this.color = color;
}

public boolean equals(CoordFive compare) {
return compare.x == this.x && compare.y == this.y && compare.T == this.T && compare.L == this.L && compare.color == this.color;
}

public CoordFive clone() {
return new CoordFive(super.clone(),this.color);
}

public boolean equals(CoordFive compare) {
return compare.x == this.x && compare.y == this.y && compare.T == this.T && compare.L == this.L && compare.color == this.color;
}

public String toString() {
char colorch;
Expand Down
60 changes: 31 additions & 29 deletions src/engine/CoordFour.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,25 @@ public CoordFour clone() {
return new CoordFour(this.x, this.y, this.T, this.L);
}

//add
public static CoordFour add(CoordFour c1, CoordFour c2) {
CoordFour sum = new CoordFour( c2.x + c1.x, c2.y +c1.y, c2.T + c1.T, c2.L + c1.L);
return sum;
/**
* A comparison function to compare this coordinate and another.
*
*
* @param c coordinate to compare to.
* @return true if the two coordinates are the same.
*/
public boolean equals(CoordFour c) {
return this.x == c.x && this.y == c.y && this.T == c.T && this.L == c.L;
}

//sub
public static CoordFour sub(CoordFour c1, CoordFour c2) {
return new CoordFour( c2.x - c1.x, c2.y - c1.y, c2.T - c1.T, c2.L - c1.L);

/**
*
* @return true if the coordinate is pure spatial, and false otherwise.
*/
public boolean isSpatial() {
return this.T == 0 && this.L == 0;
}

/**
* This function takes a 5d coord and adds another coordinates values to it.
*
Expand Down Expand Up @@ -65,6 +73,8 @@ public void makeVector() {
}
}

//TODO make a func that flattents the vector ie. 2,2,2,2 would be 1,1,1,1 but something like 2,4,0,0 would be 1,2,0,0 not 1,1,0,0

//gets the n-diagonal that a vector is
public int getNagonal(){
int nagonal = 0;
Expand All @@ -79,25 +89,6 @@ public int getNagonal(){
return nagonal;
}

/**
*
* @return true if the coordinate is pure spatial, and false otherwise.
*/
public boolean isSpatial() {
return this.T == 0 && this.L == 0;
}

/**
* A comparison function to compare this coordinate and another.
*
*
* @param c coordinate to compare to.
* @return true if the two coordinates are the same.
*/
public boolean equals(CoordFour c) {
return this.x == c.x && this.y == c.y && this.T == c.T && this.L == c.L;
}

public String toString() {
return "(" + L + "L." + "T" + T + "." + intToFile(x) + "" + (y + 1) + ")";
}
Expand All @@ -118,12 +109,23 @@ public String SANString() {
return intToFile(this.x) + "" + (this.y +1);
}

//add
public static CoordFour add(CoordFour c1, CoordFour c2) {
CoordFour sum = new CoordFour( c2.x + c1.x, c2.y +c1.y, c2.T + c1.T, c2.L + c1.L);
return sum;
}

//sub
public static CoordFour sub(CoordFour c1, CoordFour c2) {
return new CoordFour( c2.x - c1.x, c2.y - c1.y, c2.T - c1.T, c2.L - c1.L);
}

/**
* returns the corrisponding file from the int file sent, 0 indexed so a is 0 b is 1 and so on.
* @param file file to get char for
* @return char corrisponding to sent file.
*/
public static char intToFile(int file) {
protected static char intToFile(int file) {
return (char) (file + 97);
}
}
Loading

0 comments on commit 0f66982

Please sign in to comment.