This commit is contained in:
lrave 2025-05-22 18:35:52 +02:00
parent 3c9da5de45
commit 2db30292f2
1 changed files with 4 additions and 4 deletions

View File

@ -300,9 +300,9 @@ public class Board {
System.out.println("Choose piece to promote to:");
System.out.println("Enter Q for Queen, R for Rook, B for Bishop, N for Knight");
while (true) {
while (true) { // as long as user has not responded a correct answer (which would return something) don't go on with rest of code
String input = scanner.nextLine().trim().toUpperCase();
switch (input) {
switch (input) { // Switch function (which we have studied in C++ last year in Embedded Software) is just a faster way to write successive if and else if conditions, default works as the final else{
case "Q": return PieceType.Queen;
case "R": return PieceType.Rook;
case "B": return PieceType.Bishop;
@ -317,7 +317,7 @@ public class Board {
// TODO
}
public void playMove(Move move) {
public void playMove(Move move) { //For AI
int fromX = move.getFromX();
int fromY = move.getFromY();
int toX = move.getToX();
@ -339,7 +339,7 @@ public class Board {
System.out.println(toString());
}
public Board(Board otherBoard) {
public Board(Board otherBoard) { //FOR AI
this.width = otherBoard.width;
this.height = otherBoard.height;
this.turnNumber = otherBoard.turnNumber;