From f4a4f8a8cbd6a6277eff2cf9eb7cc48c35e99474 Mon Sep 17 00:00:00 2001
From: Joe Zhao <ztuowen@gmail.com>
Date: Wed, 3 Dec 2014 13:14:19 +0800
Subject: Moved helper function's ownership

---
 aux/Card.java | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

(limited to 'aux')

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
-- 
cgit v1.2.3-70-g09d2