diff --git a/server/sample_data/sample_doudizhu.json b/server/sample_data/sample_doudizhu.json new file mode 100644 index 0000000..71585c6 --- /dev/null +++ b/server/sample_data/sample_doudizhu.json @@ -0,0 +1,150 @@ +{ + "initHands": [ + "S2 H2 HK DK HQ CQ DQ CJ S9 H9 D9 C7 S6 H6 C4 D4 S3", + "C2 HA CA DA SQ ST HT D8 S7 H7 C6 D6 S5 H5 C5 S4 H4", + "RJ BJ D2 SA SK CK SJ HJ DJ CT DT C9 S8 H8 C8 D7 D5 H3 S3 D3" + ], + "playerInfo": [ + { + "id": 0, + "index": 0, + "role": "peasant" + }, + { + "id": 1, + "index": 1, + "role": "peasant" + }, + { + "id": 2, + "index": 2, + "role": "landlord" + } + ], + "moveHistory": [ + { + "playerIdx": 2, + "move": "H3 S3 D3 D5" + }, + { + "playerIdx": 0, + "move": "S9 H9 D9 S3" + }, + { + "playerIdx": 1, + "move": "P" + }, + { + "playerIdx": 2, + "move": "SJ HJ DJ D7" + }, + { + "playerIdx": 0, + "move": "HQ CQ DQ C7" + }, + { + "playerIdx": 1, + "move": "P" + }, + { + "playerIdx": 2, + "move": "P" + }, + { + "playerIdx": 0, + "move": "C4 D4" + }, + { + "playerIdx": 1, + "move": "ST HT" + }, + { + "playerIdx": 2, + "move": "SK CK" + }, + { + "playerIdx": 0, + "move": "S2 H2" + }, + { + "playerIdx": 1, + "move": "P" + }, + { + "playerIdx": 2, + "move": "P" + }, + { + "playerIdx": 0, + "move": "S6 H6" + }, + { + "playerIdx": 1, + "move": "P" + }, + { + "playerIdx": 2, + "move": "CT DT" + }, + { + "playerIdx": 0, + "move": "HK DK" + }, + { + "playerIdx": 1, + "move": "P" + }, + { + "playerIdx": 2, + "move": "RJ BJ" + }, + { + "playerIdx": 0, + "move": "P" + }, + { + "playerIdx": 1, + "move": "P" + }, + { + "playerIdx": 2, + "move": "S8 H8 C8 C9" + }, + { + "playerIdx": 0, + "move": "P" + }, + { + "playerIdx": 1, + "move": "HA CA DA H5" + }, + { + "playerIdx": 2, + "move": "P" + }, + { + "playerIdx": 0, + "move": "P" + }, + { + "playerIdx": 1, + "move": "SQ" + }, + { + "playerIdx": 2, + "move": "D2" + }, + { + "playerIdx": 0, + "move": "P" + }, + { + "playerIdx": 1, + "move": "P" + }, + { + "playerIdx": 2, + "move": "SA" + } + ] +} \ No newline at end of file diff --git a/src/components/GameBoard/cards.css b/src/assets/cards.css similarity index 100% rename from src/components/GameBoard/cards.css rename to src/assets/cards.css diff --git a/src/components/GameBoard/index.scss b/src/assets/doudizhu.scss similarity index 100% rename from src/components/GameBoard/index.scss rename to src/assets/doudizhu.scss diff --git a/src/components/GameBoard/faces/JC.gif b/src/assets/faces/JC.gif similarity index 100% rename from src/components/GameBoard/faces/JC.gif rename to src/assets/faces/JC.gif diff --git a/src/components/GameBoard/faces/JD.gif b/src/assets/faces/JD.gif similarity index 100% rename from src/components/GameBoard/faces/JD.gif rename to src/assets/faces/JD.gif diff --git a/src/components/GameBoard/faces/JH.gif b/src/assets/faces/JH.gif similarity index 100% rename from src/components/GameBoard/faces/JH.gif rename to src/assets/faces/JH.gif diff --git a/src/components/GameBoard/faces/JS.gif b/src/assets/faces/JS.gif similarity index 100% rename from src/components/GameBoard/faces/JS.gif rename to src/assets/faces/JS.gif diff --git a/src/components/GameBoard/faces/KC.gif b/src/assets/faces/KC.gif similarity index 100% rename from src/components/GameBoard/faces/KC.gif rename to src/assets/faces/KC.gif diff --git a/src/components/GameBoard/faces/KD.gif b/src/assets/faces/KD.gif similarity index 100% rename from src/components/GameBoard/faces/KD.gif rename to src/assets/faces/KD.gif diff --git a/src/components/GameBoard/faces/KH.gif b/src/assets/faces/KH.gif similarity index 100% rename from src/components/GameBoard/faces/KH.gif rename to src/assets/faces/KH.gif diff --git a/src/components/GameBoard/faces/KS.gif b/src/assets/faces/KS.gif similarity index 100% rename from src/components/GameBoard/faces/KS.gif rename to src/assets/faces/KS.gif diff --git a/src/components/GameBoard/faces/QC.gif b/src/assets/faces/QC.gif similarity index 100% rename from src/components/GameBoard/faces/QC.gif rename to src/assets/faces/QC.gif diff --git a/src/components/GameBoard/faces/QD.gif b/src/assets/faces/QD.gif similarity index 100% rename from src/components/GameBoard/faces/QD.gif rename to src/assets/faces/QD.gif diff --git a/src/components/GameBoard/faces/QH.gif b/src/assets/faces/QH.gif similarity index 100% rename from src/components/GameBoard/faces/QH.gif rename to src/assets/faces/QH.gif diff --git a/src/components/GameBoard/faces/QS.gif b/src/assets/faces/QS.gif similarity index 100% rename from src/components/GameBoard/faces/QS.gif rename to src/assets/faces/QS.gif diff --git a/src/components/GameBoard/faces/README b/src/assets/faces/README similarity index 100% rename from src/components/GameBoard/faces/README rename to src/assets/faces/README diff --git a/src/components/GameBoard/faces/joker.gif b/src/assets/faces/joker.gif similarity index 100% rename from src/components/GameBoard/faces/joker.gif rename to src/assets/faces/joker.gif diff --git a/src/index.css b/src/assets/index.css similarity index 100% rename from src/index.css rename to src/assets/index.css diff --git a/src/components/GameBoard/index.js b/src/components/GameBoard/index.js index 404d64b..d434311 100644 --- a/src/components/GameBoard/index.js +++ b/src/components/GameBoard/index.js @@ -1,6 +1,6 @@ import React from 'react'; -import './index.scss'; +import '../../assets/doudizhu.scss'; class DoudizhuGameBoard extends React.Component { constructor(props) { @@ -15,9 +15,9 @@ class DoudizhuGameBoard extends React.Component { } translateCardData(card) { - let rankClass = ""; + let rankClass; let suitClass = ""; - let rankText = ""; + let rankText; let suitText = ""; // translate rank if(card === "RJ"){ @@ -51,7 +51,6 @@ class DoudizhuGameBoard extends React.Component { } computeSingleLineHand(cards) { - console.log(cards); if(cards === "P"){ return