Skip to content
Snippets Groups Projects
Commit 4ef0f70c authored by MasterPyo's avatar MasterPyo
Browse files

variant testings

parent b1e935c0
No related merge requests found
Showing
with 45216 additions and 13 deletions
......@@ -2,7 +2,7 @@ package model;
public class Board {
public static final int PAWN = 0, ROOK = 1, KNIGHT = 2, BISHOP = 3, QUEEN = 4, KING = 5;
public static final int PAWN = 0, ROOK = 1, KNIGHT = 2, BISHOP = 3, QUEEN = 4, KING = 5, NWAP = 6, MAGICIAN = 7, GIANT = 8, KAMIKAZE =9;
public static final int A = 1, B = 2, C = 3, D = 4, E = 5, F = 6, G = 7, H = 8;
private final Piece[] pieces;
......@@ -20,18 +20,18 @@ public class Board {
// placement of pawns
if(color == Piece.WHITE) { y = 2; } else { y = 7; }
for(int x = A ; x <= H ; x++) {
createPiece(x, y, color, PAWN); // fills line 2 and line 7 with pawns
createPiece(x, y, color, NWAP); // fills line 2 and line 7 with pawns
}
// placement of rook, knight, bishop, queen, king - line 1 and line 8
if(color == Piece.WHITE) { y = 1; } else { y = 8; }
createPiece(A, y, color, ROOK);
createPiece(B, y, color, KNIGHT);
createPiece(C, y, color, BISHOP);
createPiece(A, y, color, GIANT);
createPiece(B, y, color, KAMIKAZE);
createPiece(C, y, color, MAGICIAN);
createPiece(D, y, color, QUEEN);
createPiece(E, y, color, KING);
createPiece(F, y, color, BISHOP);
createPiece(G, y, color, KNIGHT);
createPiece(H, y, color, ROOK);
createPiece(F, y, color, MAGICIAN);
createPiece(G, y, color, KAMIKAZE);
createPiece(H, y, color, GIANT);
}
}
......@@ -50,6 +50,10 @@ public class Board {
public void createPiece(int x, int y, int color, int type) {
Position p = new Position(x, y);
switch(type) {
case KAMIKAZE -> setPiece(new Kamikaze(p, color));
case GIANT -> setPiece(new Giant(p, color));
case MAGICIAN -> setPiece(new Magician(p, color));
case NWAP -> setPiece(new Nwap(p, color));
case ROOK -> setPiece(new Rook(p, color));
case KNIGHT -> setPiece(new Knight(p, color));
case BISHOP -> setPiece(new Bishop(p, color));
......
......@@ -4,17 +4,22 @@ import java.util.ArrayList;
public class Magician extends Piece{
private Piece CopiedPiece;
private Piece copiedPiece;
protected Magician(Position p, int color) {
super(p, color);
copiedPiece = new Bishop(p, color);
}
public ArrayList<Position> getAvailableMoves(Board b) {
return copiedPiece.getAvailableMoves(b);
}
public void setCopiedPiece(Piece copiedPiece) {
this.CopiedPiece = copiedPiece;
this.copiedPiece = copiedPiece;
}
public void setPosition(Position p) {
this.p = p;
CopiedPiece.setPosition(p);
copiedPiece.setPosition(p);
}
}
......@@ -34,6 +34,10 @@ public class BoardView {
if (piece.getClass() == Bishop.class) { type = Custom3dModel.BISHOP; }
if (piece.getClass() == Queen.class) { type = Custom3dModel.QUEEN; }
if (piece.getClass() == King.class) { type = Custom3dModel.KING; }
if (piece.getClass() == Nwap.class) { type = Custom3dModel.NWAP; }
if (piece.getClass() == Magician.class) { type = Custom3dModel.MAGICIAN; }
if (piece.getClass() == Giant.class) { type = Custom3dModel.GIANT; }
if (piece.getClass() == Kamikaze.class) { type = Custom3dModel.KNIGHT; }
createPiece(piece.getPosition(), piece.getColor(), type, material, model);
}
}
......
......@@ -12,16 +12,19 @@ public class Custom3dModel {
private final TriangleMesh[] model;
public static final int PAWN = 0, ROOK = 1, KNIGHT = 2, BISHOP = 3, QUEEN = 4, KING = 5;
public static final int PAWN = 0, ROOK = 1, KNIGHT = 2, BISHOP = 3, QUEEN = 4, KING = 5, NWAP = 6, MAGICIAN = 7, GIANT = 8, KAMIKAZE =9;
public Custom3dModel() {
model = new TriangleMesh[6];
model = new TriangleMesh[10];
model[PAWN] = objImport("/pawn.obj");
model[ROOK] = objImport("/rook.obj");
model[KNIGHT] = objImport("/knight.obj");
model[BISHOP] = objImport("/bishop.obj");
model[QUEEN] = objImport("/queen.obj");
model[KING] = objImport("/king.obj");
model[NWAP] = objImport("/nwap.obj");
model[MAGICIAN] = objImport("/magician.obj");
model[GIANT] = objImport("/giant.obj");
}
public TriangleMesh get(int id) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment