-
Notifications
You must be signed in to change notification settings - Fork 0
/
CardGame.java
74 lines (65 loc) · 1.71 KB
/
CardGame.java
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
import java.util.ArrayList;
/**
* An interface for a general card game.
*
* @author Kenneth Wong
*
*/
public interface CardGame {
/**
* Returns the number of players in this card game.
*
* @return the number of players in this card game
*/
public int getNumOfPlayers();
/**
* Returns the deck of cards being used in this card game.
*
* @return the deck of cards being used in this card game
*/
public Deck getDeck();
/**
* Returns the list of players in this card game.
*
* @return the list of players in this card game
*/
public ArrayList<CardGamePlayer> getPlayerList();
/**
* Returns the list of hands played on the table.
*
* @return the list of hands played on the table
*/
public ArrayList<Hand> getHandsOnTable();
/**
* Returns the index of the current player.
*
* @return the index of the current player
*/
public int getCurrentPlayerIdx();
/**
* Starts the card game.
*
* @param deck the deck of (shuffled) cards to be used in this game
*/
public void start(Deck deck);
/**
* Makes a move by the player.
*
* @param playerIdx the index of the player who makes the move
* @param cardIdx the list of the indices of the cards selected by the player
*/
public void makeMove(int playerIdx, int[] cardIdx);
/**
* Checks the move made by the player.
*
* @param playerIdx the index of the player who makes the move
* @param cardIdx the list of the indices of the cards selected by the player
*/
public void checkMove(int playerIdx, int[] cardIdx);
/**
* Checks for end of game.
*
* @return true if the game ends; false otherwise
*/
public boolean endOfGame();
}