-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathproblem21.java
112 lines (97 loc) · 1.93 KB
/
problem21.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
By Praveen Babu S, EEE
*/
import java.util.Scanner;
/**
*
*/
/**
* 1 white pawns
* 2 white knights
* 3 white bishops
* 4 white rooks
* 5 white queens
* 6 white king
*
* Black pieces use negative values
* -1 black pawn
* -2 black knight
* -3 black bishops
* -4 black rooks
* -5 black queens
* -6 black king
*
* 8| -4 -2 -3 -5 -6 -3 -2 -4
* 7| -1 -1 -1 -1 -1 -1 -1 -1
* 6| 0 0 0 0 0 0 0 0
* 5| 0 0 0 0 0 0 0 0
* 4| 0 0 0 0 0 0 0 0
* 3| 0 0 0 0 0 0 0 0
* 2| 1 1 1 1 1 1 1 1
* 1| 4 2 3 5 6 3 2 4
* ------------------------
* 1 2 3 4 5 6 7 8
*
*/
public class chess
{
/**
* @param args
*/
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
int board[][]=new int[8][8];
init(board);
display(board);
}
/**
* @param board
* @return
*/
private static boolean left2up(int[][] board)
{
return false;
}
/**
* @param board
*/
private static void display(int[][] board)
{
for(int i=0;i<8;i++)
{
for(int j=0;j<8;j++)
System.out.print(board[i][j]+"\t");
System.out.println();
}
}
/**
*
*/
private static void init(int arr[][])
{
int x=arr.length;
int y=arr[0].length;
for(int i=0;i<y;i++)
{
arr[1][i]=-1;
arr[6][i]=1;
}
arr[0][0]=-4;
arr[0][7]=-4; // rooks
arr[7][7]=4;
arr[7][0]=4;
arr[0][1]=-2;
arr[0][6]=-2; //knights
arr[7][6]=2;
arr[7][1]=2;
arr[0][2]=-3;
arr[0][5]=-3;
arr[7][2]=3; // bishops
arr[7][5]=3;
arr[0][3]=-5; // queen
arr[7][3]=5;
arr[0][4]=-6; // King
arr[7][4]=6;
}
}