簡單的Java練習小程式
只能用命令列執行
玩法可以參見
https://zh.wikipedia.org/wiki/猜数字#玩法
note:程式允許0當字首,亂數產生時會出現0字首的數字
My simple Java practice program
Only can run in the terminal(Or Windows command prompt)
Can view https://en.wikipedia.org/wiki/Bulls_and_Cows to see how to play
note:The program allows 0 to be the first word. Also computer generating random number mode.
(Sorry for my bad English...)
- 首先你需要有一個可以執行Java的環境,可以用下列指令來檢查。
java -version
- 程式有兩個模式,可以透過載入引數來改變。
執行指令如下
- "電腦產生亂數"模式(不帶引數也是這個模式):
或
java -jar 1A2B.jar
java -jar 1A2B.jar rand
- "手動輸入模式",允許輸入答案,接著進行猜題,適合你出我猜的情境
java -jar 1A2B.jar getnum
- "電腦產生亂數"模式(不帶引數也是這個模式):
- First you need install Java or JDK on your computer. To check it you can use command below:
java -version
- This program has two modes. To change it you can add argument like this:
or
java -jar 1A2B.jar
to start "Computer generated random numbers" mode, computer generate random number and guess it.java -jar 1A2B.jar rand
to start "Manual input answer" mode, you can input answer number and other people to guess.java -jar 1A2B.jar getnum