求一个javajava最简单的猜拳程序游戏程序

人机互动的java猜拳小游戏代码
资料价格:1学豆&&[]&&
文件类型: (zip)[]
文件大小:0MB
上传时间:
标&&&&&&&签: & & &
论文写作技巧
运用取随机数与人自己输入的方法,电脑与人进行石头剪刀布的猜拳游戏
您可能需要的
[] [] [] [] [] [] [] []mora-game 这是一个用java编程实现的猜拳游戏( ),主要 简单 ,取胜。 Program
238万源代码下载-
&文件名称: mora-game
& & & & &&]
&&所属分类:
&&开发工具: Java
&&文件大小: 41 KB
&&上传时间:
&&下载次数: 0
&&提 供 者:
&详细说明:这是一个用java编程实现的猜拳游戏(mora game),主要实现简单的猜拳,取胜。-
文件列表(点击判断是否您需要的文件,如果是垃圾请在下面评价投诉):
&&05猜拳游戏\05猜拳游戏.csproj&&..........\bin&&..........\...\Debug&&..........\...\.....\05猜拳游戏.exe&&..........\...\.....\05猜拳游戏.pdb&&..........\...\.....\05猜拳游戏.vshost.exe&&..........\CaiPan.cs&&..........\ClassDiagram1.cd&&..........\Computer.cs&&..........\Form1.cs&&..........\Form1.Designer.cs&&..........\Form1.resx&&..........\obj&&..........\...\Debug&&..........\...\.....\_05猜拳游戏.Form1.resources&&..........\...\.....\_05猜拳游戏.Properties.Resources.resources&&..........\...\.....\05猜拳游戏.csproj.FileListAbsolute.txt&&..........\...\.....\05猜拳游戏.csproj.GenerateResource.Cache&&..........\...\.....\05猜拳游戏.exe&&..........\...\.....\05猜拳游戏.pdb&&..........\...\.....\Refactor&&..........\...\.....\TempPE&&..........\Player.cs&&..........\Program.cs&&..........\Properties&&..........\..........\AssemblyInfo.cs&&..........\..........\Resources.Designer.cs&&..........\..........\Resources.resx&&..........\..........\Settings.Designer.cs&&..........\..........\Settings.settings
&输入关键字,在本站238万海量源码库中尽情搜索:Java猜拳游戏 - 中华考试网()
&&当前位置: >
> 文章内容
Java猜拳游戏 &&【
】&&[ 日 ]
//Computer
  import java.util.S
  public class Computer {
  //方法
  public int showFist(){
  int fist=1;
  fist=(int)(Math.random()*10)%3+1;
  ------------------------------------------------------------------------------------------------------------------------------------
  //Person
  import java.util.*;
  public class Person {
  //属性
  //方法
  public int showFist(){
  Scanner input=new Scanner(System.in);
  System.out.println("请您出拳 1:剪刀 2 石头 3 布");
  fist=input.nextInt();
  ------------------------------------------------------------------------------------------------------------------------------------
  //Game
  public class Game {
  Person role1;
  Computer role2;
  public void beginGame(){
  role1=new Person();
  role2=new Computer();
  int fist1=0,fist2=0;
  fist1=role1.showFist();
  System.out.println("您出了"+fist1);
  fist2=role2.showFist();
  System.out.println("电脑出了"+fist2);
  if(fist1==1&&fist2==3 || fist1==2&&fist2==1 ||fist1==3&&fist2==2){
  System.out.println("恭喜,你赢了");
  else if(fist1==1&&fist2==2|| fist1==2&&fist2==3 ||fist1==3&&fist2==1&& ){
  System.out.println("恭喜,你输了");
  System.out.println("平了");
  ------------------------------------------------------------------------------------------------------------------------------------
  //TestGame
  public class TestGame {
  * @param args
  public static void main(String[] args) {
  // TODO 自动生成方法存根
  Game game=new Game();
  game.beginGame();
  本书以国家人力资源和社会保障部人事考试中心2010年颁布的《全国专业技术人员计..
定价:¥39.80
优惠价:¥29.90&&《全国专业技术人员计算机应用能力考试专用教程――PowerPoint&2003中文演示文稿》以..
定价:¥39.80
优惠价:¥29.90&&
????????????
????????????
         Copyright ©
() All Rights Reservedjava 猜拳游戏代码
import java.io.BufferedR
import java.io.IOE
import java.io.InputStreamR
import java.util.R
public class FingerGuessing {
private String[] op = new String[] { "布", "剪刀", "石头" };
Random r = new Random();
private int wj = 0;
private int dn = 0;
private int count = 0;
private int go() {
int k = r.nextInt(3);
System.out.println("电脑:" + op[k]);
private void compare(int i) {
System.out.println("玩家:" + op[i - 1]);
int k = go();
if ( i - 1 == k) {
System.out.println("打平");
} else if (
i - 1 - k == 1 || i-1-k == -2) {
System.out.println("玩家获胜");
System.out.println("电脑获胜");
private void info() {
System.out.println("共" + count + "盘");
System.out.println("玩家获胜" + wj + "盘");
System.out.println("电脑获胜" + dn + "盘");
System.out.println("打平" + (count-wj-dn) + "盘");
public void start() {
String xz = "";
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("\n请选择:\n1.布\n2.剪刀\n3.石头\n结束请输入exit");
xz = br.readLine();
if (xz.equalsIgnoreCase("exit")) {
if (!xz.equals("1") && !xz.equals("2") && !xz.equals("3")) {
System.out.println("选择错误,请重新选择");
compare(Integer.parseInt(xz));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} while (!xz.equals("exit"));
* @param args
public static void main(String[] args) {
// TODO Auto-generated method stub
new FingerGuessing().start();
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467142',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'}

我要回帖

更多关于 java游戏程序设计教程 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信