Commit 974a22f2 authored by hosein's avatar hosein

game -> showplayground deleted

parent f9c7099c
...@@ -5,17 +5,14 @@ import java.util.Scanner; ...@@ -5,17 +5,14 @@ import java.util.Scanner;
public class Game { public class Game {
private PlayGround playGround; private PlayGround playGround;
private short turn; private short turn;
private String[] move;
Game() { Game() {
playGround = new PlayGround(); playGround = new PlayGround();
turn = 1; turn = 1;
move = new String[2];
} }
public boolean play(String[] move) { public boolean play(String[] move) {
if (move != null) playGround.moveNut(move); if (move == null) {
else {
if ((turn != 1)) if ((turn != 1))
System.out.println("\nCongratulation!\nWINNER IS _WHITE_ :)"); System.out.println("\nCongratulation!\nWINNER IS _WHITE_ :)");
else else
...@@ -23,17 +20,10 @@ public class Game { ...@@ -23,17 +20,10 @@ public class Game {
return false; return false;
} }
System.out.println(" playGround.getCheck() == "+playGround.getCheck()); playGround.moveNut(move);
changeTurn();
playGround.isCheck(turn); playGround.isCheck(turn);
System.out.println(" playGround.getCheck() == "+playGround.getCheck());
if (playGround.getCheck()) {
if (turn == 1)
System.out.println("White has been CHECKed!\nbe careful!");
else
System.out.println("Black has been CHECKed!\nbe careful!");
}
changeTurn();
return true; return true;
} }
...@@ -129,100 +119,17 @@ public class Game { ...@@ -129,100 +119,17 @@ public class Game {
public void startGame() { public void startGame() {
System.out.println("WELCOME!\nFor Move: Enter nut location and then enter destination.\nfor example: 'a1 h8' for move the nut in a1 to h8\nFor Get Help: Enter 'help'\nand if a player wants to resign enter 'resign'"); System.out.println("WELCOME!\nFor Move: Enter nut location and then enter destination.\nfor example: 'a1 h8' for move the nut in a1 to h8\nFor Get Help: Enter 'help'\nand if a player wants to resign enter 'resign'");
showPlayGround(); playGround.show();
System.out.print("Ready?\nPress Enter to Start!"); System.out.print("Ready?\nPress Enter to Start!");
Scanner i = new Scanner(System.in); Scanner i = new Scanner(System.in);
i.nextLine(); i.nextLine();
} }
public void showPlayGround() { public int getTurn(){return turn;}
System.out.print(" a b c d e f g h\n _ _ _ _ _ _ _ _\n");
int[][] g = PlayGround.getGround();
for (int i = 0, j; i < 8; i++) {
System.out.print((8 - i) + " ");
for (j = 0; j < 8; j++) {
switch (g[i][j]) {
case 0:
System.out.print("| ");
break;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
System.out.print("|P");
break;
case -1:
case -2:
case -3:
case -4:
case -5:
case -6:
case -7:
case -8:
System.out.print("|p");
break;
case 9:
case 10:
System.out.print("|R");
break;
case -9:
case -10:
System.out.print("|r");
break;
case 11:
case 12:
System.out.print("|K");
break;
case -11:
case -12:
System.out.print("|k");
break;
case 13:
case 14:
System.out.print("|B");
break;
case -13:
case -14:
System.out.print("|b");
break;
case 15:
System.out.print("|Q");
break;
case -15:
System.out.print("|q");
break;
case 16:
System.out.print("|X");
break;
case -16:
System.out.print("|x");
}
}
System.out.print("|\n");
}
System.out.println(" ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ");
public PlayGround getPlayGround() {
return playGround;
} }
} }
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