playgame.java
来自「Java经典例程 从外国一大学计算机教授出版物下载的代码 经典」· Java 代码 · 共 33 行
JAVA
33 行
import java.io.*;
import javagently.*;
class PlayGame {
/* The Playing Game program by J M Bishop Aug 1996
* ------------------------ Java 1.1
* updated June 2000
* Driver for playing Rocks-Scissors-Paper.
* Calls methods in the RSP class to get
* my choice and the computer's choice and
* display who has won until Q is typed.
* Illustrates conditional loops and objects
*/
public static void main (String [] args) throws IOException {
new PlayGame ();
}
PlayGame () throws IOException {
RSPGame mygame = new RSPGame ();
mygame.startGame ();
while (true) {
mygame.makemyChoice();
if (mygame.getyourChoice ()=='Q') break;
mygame.winner();
}
System.out.println("Thanks for playing");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?