diff options
author | Joe Zhao <ztuowen@gmail.com> | 2014-12-03 13:14:19 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2014-12-03 13:14:19 +0800 |
commit | f4a4f8a8cbd6a6277eff2cf9eb7cc48c35e99474 (patch) | |
tree | 082aae9a6d489a93f7ae1dc48c8404f1323afebc /aux | |
parent | 635589583b9af8994dd3f947dd3eb31157ecde1f (diff) | |
download | Mahjong-f4a4f8a8cbd6a6277eff2cf9eb7cc48c35e99474.tar.gz Mahjong-f4a4f8a8cbd6a6277eff2cf9eb7cc48c35e99474.tar.bz2 Mahjong-f4a4f8a8cbd6a6277eff2cf9eb7cc48c35e99474.zip |
Moved helper function's ownership
Diffstat (limited to 'aux')
-rw-r--r-- | aux/Card.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/aux/Card.java b/aux/Card.java index cabd2d9..c84b9bb 100644 --- a/aux/Card.java +++ b/aux/Card.java @@ -1,5 +1,9 @@ package mahjong.aux; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + /** * Created by joe on 12/1/14. */ @@ -137,4 +141,26 @@ public class Card { public boolean isZi() { return isFeng() || isYuan(); } public boolean is19() { return isLaoTou() || isZi();} public boolean isZhongZhang(){ return !is19(); } + + public static Card readCardFromInput() + { + BufferedReader br = new BufferedReader(new + InputStreamReader(System.in)); + String cardStr="Yi Wan"; + try { + cardStr = br.readLine(); + } catch (IOException e) { + e.printStackTrace(); + } + return new Card(cardStr); + } + + // TODO This way of input will certainly kill users + public static Card[] readMultipleCardFromInput(int num) + { + Card[] res=new Card[num]; + for (int i=0;i<num;++i) + res[i]=readCardFromInput(); + return res; + } }
\ No newline at end of file |