summaryrefslogtreecommitdiff
path: root/aux/Card.java
diff options
context:
space:
mode:
Diffstat (limited to 'aux/Card.java')
-rw-r--r--aux/Card.java26
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