“石头,剪子,布”的问题2 if(result == 1 || result == -2) { System.out.println("Computer Win" + ComputerChoice); System.out.println(result); } 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我的意思是,如何让结果是:“ COMPUTER WIN, ROCK BEATS SCISSORS”而不仅仅是算术结果 String [] msg = {"rock","paper", "scissors"}; ...System.out.println("Computer Win" + msg[(ComputerChoice + 3)%3] + " BEATS " + msg[(OurGuess + 3)%3]);...// your logic seems wrong? while(userPlay == 0 || userPlay == 1 || userPlay == 2){ compPlay = generator.nextInt(3); if(userPlay == compPlay) outputString = "Wow... are you psychic? Tie game."; else if(userPlay == 0 && compPlay == 1) outputString = "Your rock crumbles at the sight of the computers paper..."; else if(userPlay == 0 && compPlay == 2) outputString = "Your rock crushes the computers silly scissors!"; else if(userPlay == 1 && compPlay == 0) outputString = "You wrap your paper around the computers pebble of a rock!"; else if(userPlay == 1 && compPlay == 2) outputString = "Your paper was cutoff by the computers scissors,.."; else if(userPlay == 2 && compPlay == 0) outputString = "Your scissors are no match for good ol' rock... nothing beats rock"; else if(userPlay == 2 && compPlay == 1) outputString = "Your scissors cut up the computer paper!"; jar包无法运行 新手又来提问,三个简单的问题 在spring+hibernate架构中,我的getHibernateTemplate()为什么不能把VO转换成PO? 【SWT 有没有做“格式化输入”用的 文本框 ?】 百思不得其解: 一道继承加权限的题目 一道作业题 最强大脑中的盲填数独,用程序有没有可能实现? 这是怎么啦???(字符问题)求教大虾 关于applet中用jdbc的问题! 在JB6的Swing组的jlabel的icon属性中,为什么无法选中已经添加到工程中的.gif图形文件? 非常急的问一下:.class文件怎么才能看见? 请问怎样用java语言测试数据库的连接时间?
而不仅仅是算术结果
...
System.out.println("Computer Win" + msg[(ComputerChoice + 3)%3] + " BEATS " + msg[(OurGuess + 3)%3]);
...
// your logic seems wrong?
compPlay = generator.nextInt(3); if(userPlay == compPlay)
outputString = "Wow... are you psychic? Tie game.";
else
if(userPlay == 0 && compPlay == 1)
outputString = "Your rock crumbles at the sight of the computers paper...";
else
if(userPlay == 0 && compPlay == 2)
outputString = "Your rock crushes the computers silly scissors!";
else
if(userPlay == 1 && compPlay == 0)
outputString = "You wrap your paper around the computers pebble of a rock!";
else
if(userPlay == 1 && compPlay == 2)
outputString = "Your paper was cutoff by the computers scissors,..";
else
if(userPlay == 2 && compPlay == 0)
outputString = "Your scissors are no match for good ol' rock... nothing beats rock";
else
if(userPlay == 2 && compPlay == 1)
outputString = "Your scissors cut up the computer paper!";