-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBishop.java
More file actions
44 lines (42 loc) · 975 Bytes
/
Copy pathBishop.java
File metadata and controls
44 lines (42 loc) · 975 Bytes
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
import java.awt.Color;
import java.util.*;
/**
* Represents a bishop
* piece in a chess game.
*
* @author Linda Zeng
* @version 4.9.23
*/
public class Bishop extends Piece
{
/**
* Constructs a bishop
* with given color and image.
* It is valued at 3.
*
* @param col color of bishop
* @param filename file used to display bishop
*/
public Bishop(Color col, String filename)
{
super(col, filename, 3);
}
/**
* Indicates which locations
* bishop can move to.
* It can move diagonally.
*
* @return an ArrayList of
* locations this can
* move to
*/
public ArrayList<Location> destinations()
{
ArrayList<Location> res = new ArrayList<Location>();
sweep(res, Location.NORTHEAST);
sweep(res, Location.NORTHWEST);
sweep(res, Location.SOUTHEAST);
sweep(res, Location.SOUTHWEST);
return res;
}
}