-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElevensBoard.java
More file actions
92 lines (80 loc) · 3.27 KB
/
Copy pathElevensBoard.java
File metadata and controls
92 lines (80 loc) · 3.27 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
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
import java.util.List;
import java.util.ArrayList;
/**
* The ElevensBoard class represents the board in a game of Elevens.
*/
public class ElevensBoard extends Board{
/**
* The size (number of cards) on the board.
*/
private static final int BOARD_SIZE = 9;
/**
* Flag used to control debugging print statements.
*/
private static final boolean I_AM_DEBUGGING = false;
/**
* Creates a new <code>ElevensBoard</code> instance.
*/
public ElevensBoard(){
super(BOARD_SIZE);
}
/* Note:
* Before you write any new methods, recall that you can use all the non-abstract
public methods in the Board class.
* You cannot access the private instance variables from the Board class, but with
the available public methods, you shouldn't need to. If you think you do, think
of a way to avoid it!
* It is possible to complete the project without implementing any methods
other than those here, but if you think that something should be added so the code
is clearer, feel free to do so.
*/
/**
* Determines if the selected cards form a valid group for removal.
* In Elevens, the legal groups are (1) a pair of non-face cards
* whose values add to 11, and (2) a group of three cards consisting of
* a jack, a queen, and a king in some order.
* @param selectedCards the list of the indices of the selected cards.
* @return true if the selected cards form a valid group for removal;
* false otherwise.
*/
public boolean isLegal(List<Integer> selectedCards) {
// TODO: implement isLegal
return false;
}
/**
* Determine if there are any legal plays left on the board.
* In Elevens, there is a legal play if the board contains
* (1) a pair of non-face cards whose values add to 11, or (2) a group
* of three cards consisting of a jack, a queen, and a king in some order.
* @return true if there is a legal play left on the board;
* false otherwise.
*/
public boolean anotherPlayIsPossible() {
//TODO: implement anotherPlayIsPossible
return false;
}
/**
* Check for an 11-pair in the selected cards.
* @param selectedCards selects a subset of this board. It is list
* of indexes into this board that are searched
* to find an 11-pair.
* @return true if the board entries in selectedCards
* contain an 11-pair; false otherwise.
*/
private boolean containsPairSum11(List<Integer> selectedCards) {
//TODO: implement containsPairSum11
return false;
}
/**
* Check for a JQK in the selected cards.
* @param selectedCards selects a subset of this board. It is list
* of indexes into this board that are searched
* to find a JQK group.
* @return true if the board entries in selectedCards
* include a jack, a queen, and a king; false otherwise.
*/
private boolean containsJQK(List<Integer> selectedCards) {
//TODO: implement containsJQK
return false;
}
}