import java.io.*;
public class CheckersGame {
public static void main (String []args) throws IOException {
BufferedReader jill = new BufferedReader (new InputStreamReader (System.in));
System.out.print("Enter name of the first to move: ");
String name = jill.readLine();
System.out.print("Enter name of " + name + "'s opponent: ");
String opo = jill.readLine();
System.out.println("You'll handle the * stones " + name+".");
System.out.println("You'll handle the o stones " + opo);
String[][] board = {{" ","0 ","1 ","2 ","3 ","4 ","5 ","6 ","7 "," "},
{"0 "," ","o "," ","o "," ","o"," "," o ","0"},
{"1 ","o "," ","o "," ","o "," ","o "," ","1"},
{"2 "," ","o "," ","o "," ","o "," ","o ","2"},
{"3 "," "," "," "," "," "," "," "," ","3"},
{"4 "," "," "," "," "," "," "," "," ","4"},
{"5 ","* "," ","* "," ","* "," ","* "," ","5"},
{"6 "," ","* "," ","* "," ","* "," ","* ","6"},
{"7 ","* "," ","* "," ","* "," ","* "," ","7"},
{" ","0 ","1 ","2 ","3 ","4 ","5 ","6 ","7 "," "}};
for(int x=0; x<10; x++){
for(int y=0; y<10; y++){
System.out.print(board[x][y]);
}
System.out.println();
}
boolean team = true;
System.out.println("\nInstructions: input the ordinates to move first, then, the ordinates where you will move separated with space.\n(e.g 34 45)");
for(;;){
if(team){
System.out.print(name+"'s move: ");
String move = jill.readLine();
int a = Integer.parseInt(""+move.charAt(0))+1;
int b = Integer.parseInt(""+move.charAt(1))+1;
int c = Integer.parseInt(""+move.charAt(3))+1;
int d = Integer.parseInt(""+move.charAt(4))+1;
if(board[a][b].equals("* ")&&board[c][d].equals(" ")&&((a-c==1)||a-c==-1)&&(b-d==1||b-d==-1)){
board[a][b] = " ";
board[c][d] = "* ";
}
else if(board[a+1][b+1].equals("o ")&&board[a][b].equals("* ")&&board[c][d].equals(" ")){
board[a+1][b+1] = " ";
board[a][b] = " ";
board[c][d] = "* ";
}
else if(board[a+1][b-1].equals("o ")&&board[a][b].equals("* ")&&board[c][d].equals(" ")){
board[a+1][b-1] = " ";
board[a][b] = " ";
board[c][d] = "* ";
}
else if(board[a-1][b+1].equals("o ")&&board[a][b].equals("* ")&&board[c][d].equals(" ")){
board[a-1][b+1] = " ";
board[a][b] = " ";
board[c][d] = "* ";
}
else if(board[a-1][b-1].equals("o ")&&board[a][b].equals("* ")&&board[c][d].equals(" ")){
board[a-1][b-1] = " ";
board[a][b] = " ";
board[c][d] = "* ";
}
else{
System.out.println("Invalid input!");
}
for(int x = 0; x< 10; x++){
for(int y = 0; y < 10; y++){
System.out.print(board[x][y]);
}
System.out.println();
}
team = false;
}
else if(team == false){
System.out.print(opo+"'s move: ");
String move = jill.readLine();
int a = Integer.parseInt(""+move.charAt(0))+1;
int b = Integer.parseInt(""+move.charAt(1))+1;
int c = Integer.parseInt(""+move.charAt(3))+1;
int d = Integer.parseInt(""+move.charAt(4))+1;
if(board[a][b].equals("o ")&&board[c][d].equals(" ")&&((a-c==1)||a-c==-1)&&(b-d==1||b-d==-1)){
board[a][b] = " ";
board[c][d] = "o ";
}
else if(board[a+1][b+1].equals("* ")&&board[a][b].equals("o ")&&board[c][d].equals(" ")){
board[a+1][b+1] = " ";
board[a][b] = " ";
board[c][d] = "o ";
}
else if(board[a+1][b-1].equals("* ")&&board[a][b].equals("o ")&&board[c][d].equals(" ")){
board[a+1][b-1] = " ";
board[a][b] = " ";
board[c][d] = "o ";
}
else if(board[a-1][b+1].equals("* ")&&board[a][b].equals("o ")&&board[c][d].equals(" ")){
board[a-1][b+1] = " ";
board[a][b] = " ";
board[c][d] = "o ";
}
else if(board[a-1][b-1].equals("* ")&&board[a][b].equals("o ")&&board[c][d].equals(" ")){
board[a-1][b-1] = " ";
board[a][b] = " ";
board[c][d] = "o ";
}
else{
System.out.println("Invalid input!");
}
for(int x = 0; x< 10; x++){
for(int y = 0; y < 10; y++){
System.out.print(board[x][y]);
}
System.out.println();
}
team = true;
}
}
}
}
Help me improve this code to become better one. You can email me at my email address<SNIPPED>.
This gonna be my project for my subject Basic Programming.
Thank you!