-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
62 lines (53 loc) · 1.75 KB
/
Player.java
File metadata and controls
62 lines (53 loc) · 1.75 KB
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author TARUN BHARDWAJ
*/
import java.util.List;
import java.util.ArrayList;
public class Player {
public final int PAWNS = 8;
public final int BISHOPS = 2;
public final int ROOKS = 2;
public boolean white;
private List<Pieces> pieces = new ArrayList<>();
public Player(boolean white) {
super();
this.white = white;
}
public List<Pieces> getPieces() {
return pieces;
}
public void initializePieces(){
if(this.white == true){
for(int i=0; i<PAWNS; i++){ // draw pawns
pieces.add(new Pawn(true,i,2));
}
pieces.add(new Rook(true, 0, 0));
pieces.add(new Rook(true, 7, 0));
pieces.add(new Bishop(true, 2, 0));
pieces.add(new Bishop(true, 5, 0));
pieces.add(new Knight(true, 1, 0));
pieces.add(new Knight(true, 6, 0));
pieces.add(new Queen(true, 3, 0));
pieces.add(new King(true, 4, 0));
}
else{
for(int i=0; i<PAWNS; i++){ // draw pawns
pieces.add(new Pawn(true,i,6));
}
pieces.add(new Rook(true, 0, 7));
pieces.add(new Rook(true, 7, 7));
pieces.add(new Bishop(true, 2, 7));
pieces.add(new Bishop(true, 5, 7));
pieces.add(new Knight(true, 1, 7));
pieces.add(new Knight(true, 6, 7));
pieces.add(new Queen(true, 3, 7));
pieces.add(new King(true, 4, 7));
}
}
}