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