Commit 25e80531 authored by hamed's avatar hamed

improve console intraction with app (add raw and column names in board for easier interaction)

parent 7fa5c498
......@@ -91,8 +91,10 @@ public class Board {
@Override
public String toString() {
String str = "";
String str = " a b c d e f g h\n";
str = str + "------------------\n";
for (int j = 0 ; j < 8 ; j++){
str = str+(j+1)+"|";
for (int i = 0 ; i < 7 ; i++){
if(board[i][j]!=null) {
str = str + board[i][j] + " ";
......@@ -101,11 +103,14 @@ public class Board {
str = str + "0 ";
}
if(board[7][j]!=null) {
str = str + board[7][j] + "\n";
str = str + board[7][j];
}
else
str = str + "0\n";
str = str + "0";
str = str+"|"+(j+1)+"\n";
}
str = str + "------------------\n";
str = str+ " a b c d e f g h\n";
return str;
}
}
......@@ -33,14 +33,15 @@ public class Main {
continue;
}
if (b.getMove(x, y, dx, dy)) {
System.out.println("Moved");
System.out.println(splt[0]+" Moved to "+splt[1]);
whichMove = false;
} else {
System.out.println("Incorrect Move, Please insert Correct Movement");
}
}
}
System.out.println(b);
if(!whichMove)
System.out.println(b);
//--------------------------------------------------------------------------
if(whichMove) continue;
System.out.println("Black Turn.... insert a move in a line");
......@@ -61,13 +62,14 @@ public class Main {
continue;
}
if(b.getMove(x,y,dx,dy)){
System.out.println("Moved");
System.out.println(splt[0]+" Moved to "+splt[1]);
whichMove = true;
}else {
System.out.println("Incorrect Move, Please insert Correct Movement");
}
}
System.out.println(b);
if(whichMove)
System.out.println(b);
}
}
public static void printMoves(ArrayList<int[]> moves){
......
Markdown is supported
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