-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueen.java
More file actions
48 lines (46 loc) · 1.11 KB
/
Copy pathQueen.java
File metadata and controls
48 lines (46 loc) · 1.11 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
import java.awt.Color;
import java.util.*;
/**
* Represents a queen in chess.
*
* @author Linda Zeng
* @version 4.9.23
*/
public class Queen extends Piece
{
/**
* Constructs a queen
* with given color and filename.
* It is valued at 9.
*
* @param col color of queen
* @param fileName file with image of queen
*/
public Queen(Color col, String filename)
{
super(col, filename, 9);
}
/**
* Indicates which locations
* the queen can move to.
* Can move in all directions.
*
* @return an ArrayList of
* locations this can
* move to
*/
public ArrayList<Location> destinations()
{
ArrayList<Location> res = new ArrayList<Location>();
sweep(res, Location.NORTH);
sweep(res, Location.EAST);
sweep(res, Location.SOUTH);
sweep(res, Location.WEST);
sweep(res, Location.NORTHEAST);
sweep(res, Location.NORTHWEST);
sweep(res, Location.SOUTHEAST);
sweep(res, Location.SOUTHWEST);
//System.out.println(res);
return res;
}
}