diff --git a/README.md b/README.md index 3bceed2..4759f44 100644 --- a/README.md +++ b/README.md @@ -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模式 diff --git a/src/csci4963u20/project/doudizhu/Deck.java b/src/csci4963u20/project/doudizhu/Deck.java index 39509d5..4aff55a 100644 --- a/src/csci4963u20/project/doudizhu/Deck.java +++ b/src/csci4963u20/project/doudizhu/Deck.java @@ -45,7 +45,7 @@ public void shuffle(){ * Sort the deck. */ public void sortDeck(){ - Collections.sort(cards); + Collections.sort(cards, Collections.reverseOrder()); } /** diff --git a/src/csci4963u20/project/doudizhu/MainBody.java b/src/csci4963u20/project/doudizhu/MainBody.java index 625c2a2..ff86d5c 100644 --- a/src/csci4963u20/project/doudizhu/MainBody.java +++ b/src/csci4963u20/project/doudizhu/MainBody.java @@ -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);