Commit 8d5dfa55 authored by amir's avatar amir

possible move javadoc

parent a67ada9e
...@@ -22,6 +22,7 @@ public class Main { ...@@ -22,6 +22,7 @@ public class Main {
System.out.println("Player1, it's your turn!"); System.out.println("Player1, it's your turn!");
} }
else { else {
//if there is no possible move prints pass
System.out.println("pass"); System.out.println("pass");
turns++; turns++;
} }
...@@ -30,6 +31,7 @@ public class Main { ...@@ -30,6 +31,7 @@ public class Main {
if (play2.numberOfPlayerPossibleMoves(play1.getArr1(), play2.getArr2()) != 0) if (play2.numberOfPlayerPossibleMoves(play1.getArr1(), play2.getArr2()) != 0)
System.out.println("Player2, it's your turn!"); System.out.println("Player2, it's your turn!");
else { else {
//if there is no possible move prints pass
System.out.println("pass"); System.out.println("pass");
continue; continue;
} }
...@@ -37,6 +39,7 @@ public class Main { ...@@ -37,6 +39,7 @@ public class Main {
Scanner scanner = new Scanner(System.in); Scanner scanner = new Scanner(System.in);
String nl = scanner.nextLine(); String nl = scanner.nextLine();
char[] f = nl.toCharArray(); char[] f = nl.toCharArray();
// scanning the x and y coordinates from user
int y = f[0] - '1' + 1; int y = f[0] - '1' + 1;
int x = f[2] - 'A' + 1; int x = f[2] - 'A' + 1;
if ((x >= 1) && (x < 9) && (y >= 1) && (y < 9)) { if ((x >= 1) && (x < 9) && (y >= 1) && (y < 9)) {
......
...@@ -13,5 +13,4 @@ public class Player1 extends Players { ...@@ -13,5 +13,4 @@ public class Player1 extends Players {
return arr1; return arr1;
} }
} }
...@@ -110,13 +110,14 @@ public class Players { ...@@ -110,13 +110,14 @@ public class Players {
} }
/** /**
* * this method checks if the move is possible, then equalize the color of the
* @param arrOpponent * player's disc in a line from the blank to the first player's disk that seen
* @param arr * @param arrOpponent list of opponent discs' coordinates
* @param x * @param arr list of the player disc's coordinates
* @param y * @param x the x of the blank space
* @param moveX * @param y the y of the blank space
* @param moveY * @param moveX the direction to the x es
* @param moveY the direction to the y es
*/ */
public void equalize(int[][] arrOpponent, int[][]arr, int x, int y, int moveX, int moveY) { public void equalize(int[][] arrOpponent, int[][]arr, int x, int y, int moveX, int moveY) {
if (checkTheMoveIfPossible(arrOpponent, arr, x, y, moveX, moveY)) { if (checkTheMoveIfPossible(arrOpponent, arr, x, y, moveX, moveY)) {
......
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