Skip to content

Commit

Permalink
WIP: add descriptions of each class in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yichen0104 committed Aug 18, 2020
1 parent fefcd30 commit 000a404
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,17 @@ This project is an implementation of a popular Chinese card game: Doudizhu. The
The game is played among three people with one pack of cards (54 count), including the two differentiated jokers. It starts with each player bidding for the "landlord" position. Those who lose the bid or do not bid enter the game as the "peasants" team competing against the landlord. For each player, the objective of the game is to be the first one to have no cards left.
The game starts with the landlord. In each round, each player must be able to show a deck of a certain pattern following that of the last player in turn, while each card must be larger than each of the last player's. A player with no available cards to show will be skipped in the round. If both 2 other players are skipped for a pattern shown by a player, the game enters another round starting with that player.
## Logistics
* Application: main program 主程序,负责客户端服务器通信和逻辑
* Card: ADT of a card 卡牌ADT
* CardPanel: JPanel for showing a deck of cards, used for presenting current deck and player's own deck 卡牌展示框,展示当前一轮打出的牌组/玩家自己手上的的牌组
* CardView: JButton for visualization of a card 卡牌作为JButton展示
* Client: class for server 客户端
* ControlToolBar: JToolBar for sending cards/skipping 控制栏,负责发送发牌/要不起请求
* Deck: ADT of a card deck 牌组
* MainBody: main UI 主用户界面
* Message: ADT of a serializable message for server-client communication 信息ADT,可序列化
* OpponentStatusBar: JPanel of two OpponentStatusPanel 展示对方两个玩家的剩余牌数
* OpponentStatusPanel: JPanel of an opponent's status 展示一个对方玩家的剩余牌数
* Player: ADT of a player 玩家ADT
* Server: class of server 服务器
* StartPanel: JPanel for starting/connecting a server 开始页面选择client或server模式
2 changes: 1 addition & 1 deletion src/csci4963u20/project/doudizhu/Deck.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void shuffle(){
* Sort the deck.
*/
public void sortDeck(){
Collections.sort(cards);
Collections.sort(cards, Collections.reverseOrder());
}

/**
Expand Down
10 changes: 6 additions & 4 deletions src/csci4963u20/project/doudizhu/MainBody.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@ public MainBody(){
add(ctb);

Deck d = new Deck();
d.add(new Card(13, "K"));
d.add(new Card(8, "8"));
d.add(new Card(8, "8"));
d.add(new Card(3, "3"));
d.add(new Card(4, "4"));
d.add(new Card(5, "5"));
d.add(new Card(8, "8"));
d.add(new Card(8, "8"));
d.add(new Card(13, "K"));
d.sortDeck();

Deck d2 = new Deck();
d2.add(new Card(5, "5"));
d2.add(new Card(12, "Q"));
d2.add(new Card(8, "8"));
d2.add(new Card(8, "8"));
d2.add(new Card(12, "Q"));
d2.add(new Card(13, "K"));
d2.sortDeck();

current_deck_panel.updateDeck(d);
own_deck_panel.updateDeck(d);
Expand Down

0 comments on commit 000a404

Please sign in to comment.