Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows: When the program begins, a random integer number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. Java program for Rock, paper and scissors Game The game will be played between user and the computer. The choices taken by the computer are independent of the choice of the user. At the end of the 3 rounds, the winner will be declared. I made a Rock, Paper, Scissors game and would like the code to be reviewed. Rock, Paper, Scissors Game in Java. Numbers and think of what is the base of Rock. Java Rock Paper Scissors Game The rock paper scissors is a game where through hand formations; the decision of the winner is made. The game works on the following principles: The rock defeats scissors.
Rock Paper Scissors Lizard Spock - Java GUI Game - Homework Help
BetPanel.java
packageedu.witc.guts; |
importjava.awt.BorderLayout; |
importjava.awt.Color; |
importjava.awt.FlowLayout; |
importjava.awt.GridLayout; |
importjava.awt.event.ActionEvent; |
importjava.awt.event.ActionListener; |
importjavax.swing.BorderFactory; |
importjavax.swing.JButton; |
importjavax.swing.JComboBox; |
importjavax.swing.JFrame; |
importjavax.swing.JLabel; |
importjavax.swing.JOptionPane; |
importjavax.swing.JPanel; |
importjavax.swing.border.Border; |
publicclassBetPanelextendsJFrame{ |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//VARIABLES[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
publicint userMoney =10; |
publicint compMoney =10; |
publicint winCount =0; |
publicint lossCount =0; |
publicint tieCount =0; |
privateint maxBet =0; |
protectedint userBet =0; |
protectedint compBet =0; |
protectedint betPool =0; |
privateString arrayOfBets[]; |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//FORM ELEMENTS[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
privateJPanel BetContainerPanel =newJPanel(); //TOP PANEL of GAME |
privateJPanel LeftPanel =newJPanel(); //USER |
privateJPanel RightPanel =newJPanel(); //COMP |
privateJPanel BottomPanel =newJPanel(); //SCORE |
privateBorder paddingBorder =BorderFactory.createEmptyBorder(2,4,2,6); |
privateBorder recessedBorder =BorderFactory.createLoweredBevelBorder(); |
privateBorder blackLineBorder =BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK); |
privateJLabel lblLabelUserName =newJLabel('Player: '); |
privateJLabel lblUserName; |
privateJLabel lblUserName2; |
privateJLabel lblLabelUserMoney =newJLabel('Current Money: '); |
privateJLabel lblUserMoney =newJLabel(String.valueOf(userMoney)); |
privateJLabel lblLabelUserBet =newJLabel('Current Bet: '); |
JComboBox cmbBetAmount; |
protectedJButton btnLockBet =newJButton('Lock Bet'); |
privateJLabel lblCompName =newJLabel('Mr. Hyde'); |
privateJLabel lblLabelCompMoney =newJLabel('Current Money: '); |
privateJLabel lblCompMoney =newJLabel(String.valueOf(compMoney)); |
privateJLabel lblLabelCompBet =newJLabel('Current Bet: '); |
privateJLabel lblCompBet =newJLabel(String.valueOf(compBet)); |
privateJButton btnRules =newJButton('Game Rules'); |
privateJLabel lblLabelScore =newJLabel('SCORE'); |
privateJLabel lblUserScore =newJLabel(''); |
privateJLabel lblTieGame =newJLabel(''); |
privateJLabel lblCompScore =newJLabel(''); |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//CONSTRUCTOR[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
publicBetPanel(){ |
getUserName(); |
createBetEventListeners(); |
createUserPanel(); |
createCompPanel(); |
createScorePanel(); |
createContainer(); |
promptRules(); |
add(BetContainerPanel, BorderLayout.NORTH); |
} |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//EVENTS[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
publicvoidcreateBetEventListeners(){ |
btnRules.addActionListener(newActionListener(){ |
publicvoidactionPerformed(ActionEvente){ |
displayRules(); |
} |
}); |
} |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//PANELS[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
publicvoidcreateContainer(){ |
BetContainerPanel.setLayout(newBorderLayout()); |
BetContainerPanel.add(LeftPanel, BorderLayout.WEST); |
BetContainerPanel.add(RightPanel, BorderLayout.EAST); |
BetContainerPanel.add(BottomPanel, BorderLayout.SOUTH); |
} |
publicvoidcreateUserPanel(){ |
assignMaxBet(); |
assignCompBet(); |
LeftPanel.setLayout(newFlowLayout()); |
LeftPanel.add(lblLabelUserName); |
lblUserName.setBorder(BorderFactory.createCompoundBorder(recessedBorder,paddingBorder)); |
LeftPanel.add(lblUserName); |
LeftPanel.add(lblLabelUserMoney); |
lblUserMoney.setBorder(BorderFactory.createCompoundBorder(recessedBorder,paddingBorder)); |
LeftPanel.add(lblUserMoney); |
LeftPanel.add(lblLabelUserBet); |
LeftPanel.add(cmbBetAmount); |
LeftPanel.add(btnLockBet); |
} |
publicvoidcreateCompPanel(){ |
RightPanel.setLayout(newFlowLayout()); |
lblCompName.setBorder(BorderFactory.createCompoundBorder(recessedBorder,paddingBorder)); |
RightPanel.add(lblCompName); |
RightPanel.add(lblLabelCompMoney); |
lblCompMoney.setBorder(BorderFactory.createCompoundBorder(recessedBorder,paddingBorder)); |
RightPanel.add(lblCompMoney); |
RightPanel.add(lblLabelCompBet); |
lblCompBet.setBorder(BorderFactory.createCompoundBorder(recessedBorder,paddingBorder)); |
RightPanel.add(lblCompBet); |
RightPanel.add(btnRules); |
} |
publicvoidcreateScorePanel(){ |
BottomPanel.setLayout(newGridLayout(2,3,5,5)); |
BottomPanel.setBorder(BorderFactory.createCompoundBorder(blackLineBorder, paddingBorder)); |
BottomPanel.add(lblUserName2); |
lblLabelScore.setHorizontalTextPosition(JLabel.CENTER); |
BottomPanel.add(lblLabelScore); |
BottomPanel.add(newJLabel('Mr. Hyde')); |
lblUserScore.setBorder(BorderFactory.createCompoundBorder(recessedBorder,paddingBorder)); |
BottomPanel.add(lblUserScore, BorderLayout.WEST); |
lblTieGame.setBorder(BorderFactory.createCompoundBorder(recessedBorder,paddingBorder)); |
BottomPanel.add(lblTieGame, BorderLayout.CENTER); |
lblCompScore.setBorder(BorderFactory.createCompoundBorder(recessedBorder,paddingBorder)); |
BottomPanel.add(lblCompScore, BorderLayout.EAST); |
} |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//BETS[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
publicvoidassignMaxBet(){ |
if (userMoney >=5){maxBet=5;} |
elseif(userMoney 0){}//recap the game. game finished. |
else maxBet = userMoney; |
arrayOfBets =newString[maxBet]; //define the limit of the array |
for(int i =0;i<maxBet;i++){arrayOfBets[i] =String.valueOf(i+1);} //fill the array |
cmbBetAmount =newJComboBox(arrayOfBets); //fill the combo box |
} |
publicvoidassignCompBet(){ //assigns a value of 1-5 for computer bet |
int compDraw =0; |
if (compMoney >=5) compDraw =5; |
elseif(compMoney 0){}//recap the game. game finished. |
else compDraw = compMoney; |
compBet = (int) Math.round((Math.random()*compDraw) +1); |
} |
publicvoidgatherBets(){ |
userBet = (int) cmbBetAmount.getSelectedItem(); |
betPool = userBet + compBet; |
userMoney -= userBet; |
compMoney -= compBet; |
} |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//RULES[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |
publicvoidpromptRules(){ |
int option =0; |
option =JOptionPane.showConfirmDialog(null, 'Would you like to read the rules?'); |
if(option JOptionPane.YES_OPTION){ |
displayRules(); |
} |
} |
publicvoiddisplayRules(){ |
String rulesMsg ='Rock crushes scissors (rock wins)n'+ |
'Rock crushes lizard (rock wins)n'+ |
'Paper disproves Spock (paper wins)n'+ |
'Paper covers rock (paper wins)n'+ |
'Scissors cuts paper (scissors wins)n'+ |
'Scissors decapitate lizard (scissors wins)n'+ |
'Lizard poisons Spock (lizard wins)n'+ |
'Lizard eats paper (lizard wins)n'+ |
'Spock smashes scissors (Spock wins)n'+ |
'Spock vaporizes rock (Spock wins)n'+ |
'Tie if both choices are the samenn'+ |
'User must bet before choosing their selection!'; |
JOptionPane.showMessageDialog(null, rulesMsg); |
} |
publicvoidgetUserName(){ |
String str =JOptionPane.showInputDialog(null, 'Enter your name : ', 'User Name', JOptionPane.OK_OPTION); |
if(str !=null) { |
int confirmName =JOptionPane.showConfirmDialog(null, 'You entered the text : '+ str +', keep as user name?', 'Confirm', JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); |
if (confirmName JOptionPane.YES_OPTION){ |
lblUserName =newJLabel(str); |
lblUserName2 =newJLabel(str); |
} |
else getUserName(); |
} |
} |
} |
ChoicePanel.java
packageedu.witc.guts; |
importjava.awt.BorderLayout; |
importjava.awt.GridLayout; |
importjava.awt.event.ActionEvent; |
importjava.awt.event.ActionListener; |
importjavax.swing.ImageIcon; |
importjavax.swing.JButton; |
importjavax.swing.JPanel; |
publicclassChoicePanelextendsBetPanel{ |
publicint userChoice =0; |
publicint compChoice =0; |
publicImageIcon choicesImg[] = { |
newImageIcon('images/weapons/0.gif'), |
newImageIcon('images/weapons/1.gif'), |
newImageIcon('images/weapons/2.gif'), |
newImageIcon('images/weapons/3.gif'), |
newImageIcon('images/weapons/4.gif'), |
newImageIcon('images/weapons/5.gif')}; |
privateJPanel ChoicePanel =newJPanel(); //top panel |
privateJButton btnRock =newJButton(choicesImg[1]); |
privateJButton btnPaper =newJButton(choicesImg[2]); |
privateJButton btnScissors =newJButton(choicesImg[3]); |
privateJButton btnLizard =newJButton(choicesImg[4]); |
privateJButton btnSpock =newJButton(choicesImg[5]); |
publicChoicePanel(){ |
disableButtons(); |
createChoiceEventListeners(); |
createChoicePanel(); |
add(ChoicePanel, BorderLayout.CENTER); |
} |
publicvoidcreateChoiceEventListeners(){ |
btnRock.addActionListener(newActionListener() { //On press disable the option to change bet, and assign the user bet |
@Override |
publicvoidactionPerformed(ActionEventarg0) { |
userChoice =1; |
disableButtons(userChoice); |
} |
}); |
btnPaper.addActionListener(newActionListener() { //On press disable the option to change bet, and assign the user bet |
@Override |
publicvoidactionPerformed(ActionEventarg0) { |
userChoice =2; |
disableButtons(userChoice); |
} |
}); |
btnScissors.addActionListener(newActionListener() { //On press disable the option to change bet, and assign the user bet |
@Override |
publicvoidactionPerformed(ActionEventarg0) { |
userChoice =3; |
disableButtons(userChoice); |
} |
}); |
btnLizard.addActionListener(newActionListener() { //On press disable the option to change bet, and assign the user bet |
@Override |
publicvoidactionPerformed(ActionEventarg0) { |
userChoice =4; |
disableButtons(userChoice); |
} |
}); |
btnSpock.addActionListener(newActionListener() { //On press disable the option to change bet, and assign the user bet |
@Override |
publicvoidactionPerformed(ActionEventarg0) { |
userChoice =5; |
disableButtons(userChoice); |
} |
}); |
btnLockBet.addActionListener(newActionListener() { //On press disable the option to change bet, and assign the user bet |
@Override |
publicvoidactionPerformed(ActionEventarg0) { |
cmbBetAmount.setEnabled(false); |
btnLockBet.setEnabled(false); |
enableButtons(); |
} |
}); |
} |
publicvoidcreateChoicePanel(){ |
ChoicePanel.setLayout(newGridLayout(1,5)); |
ChoicePanel.add(btnRock); |
ChoicePanel.add(btnPaper); |
ChoicePanel.add(btnScissors); |
ChoicePanel.add(btnLizard); |
ChoicePanel.add(btnSpock); |
} |
publicvoiddisableButtons(){ |
btnRock.setEnabled(false); |
btnPaper.setEnabled(false); |
btnScissors.setEnabled(false); |
btnLizard.setEnabled(false); |
btnSpock.setEnabled(false); |
} |
publicvoiddisableButtons(intnotThis){ |
btnRock.setEnabled(false); |
btnPaper.setEnabled(false); |
btnScissors.setEnabled(false); |
btnLizard.setEnabled(false); |
btnSpock.setEnabled(false); |
switch(notThis){ |
case1: |
btnRock.setEnabled(true); |
break; |
case2: |
btnPaper.setEnabled(true); |
break; |
case3: |
btnScissors.setEnabled(true); |
break; |
case4: |
btnLizard.setEnabled(true); |
break; |
case5: |
btnSpock.setEnabled(true); |
break; |
} |
} |
publicvoidenableButtons(){ |
btnRock.setEnabled(true); |
btnPaper.setEnabled(true); |
btnScissors.setEnabled(true); |
btnLizard.setEnabled(true); |
btnSpock.setEnabled(true); |
} |
} |
DecisionPanel.java
packageedu.witc.guts; |
importjavax.swing.ImageIcon; |
importjavax.swing.JFrame; |
importjavax.swing.JPanel; |
publicclassDecisionPanelextendsChoicePanel{ |
privateint winnerChoice =0; //is applied in chooseWinner |
privateString winningActionString =''; //is applied in chooseWinner |
privateint loserChoice =0; //is applied in chooseWinner |
privateString winner =''; |
privateString loser =''; |
privateImageIcon winnerImg =null; |
privateImageIcon loserImg =null; |
privateString choicesString[] = {'','Rock','Paper','Scissors','Lizard','Spock'}; |
privateString actionString[] = {'_______','cuts','covers','poisons','smashes','decapitates','eats','disproves','vaporizes','crushes','ties'}; |
privateJPanel winnerPanel =newJPanel(); |
privateJPanel actionPanel =newJPanel(); |
privateJPanel loserPanel =newJPanel(); |
privateJPanel DecisionContainer =newJPanel(); |
publicDecisionPanel(){ |
compareChoices(); |
createDecisionContainer(); |
createWinnerPanel(); |
createActionPanel(); |
createLoserPanel(); |
this.pack(); |
this.setTitle('Rock,Paper,Scissors,Lizard,Spock'); |
this.setSize(1024,620); |
this.setLocationRelativeTo(null); |
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
} |
publicvoidcompareChoices(){ |
switch(userChoice){ |
case1: |
if(compChoice 1){ //Rock vs Rock |
winner ='Player'; |
winnerChoice =1; |
winningActionString = actionString[10]; //Tie |
loser ='Computer'; |
loserChoice =1; |
tieCount +=1; |
userMoney += userBet; |
compMoney += compBet; |
betPool =0; |
break; |
} |
if(compChoice 2){ //Rock vs Paper |
winner ='Computer'; |
winnerChoice =2; |
winningActionString = actionString[2]; //Covers |
compMoney += betPool; |
loser ='Player'; |
loserChoice =1; |
betPool =0; |
lossCount +=1; |
break; |
} |
if(compChoice 3){ //Rock vs Scissors |
winner ='Player'; |
winnerChoice =1; |
winningActionString = actionString[9]; //crushes |
userMoney += betPool; |
loser ='Computer'; |
loserChoice =3; |
betPool =0; |
winCount +=1; |
break; |
} |
if(compChoice 4){ //Rock vs Lizard |
winner ='Player'; |
winnerChoice =1; |
winningActionString = actionString[9]; //crushes |
userMoney += betPool; |
loser ='Computer'; |
loserChoice =4; |
betPool =0; |
winCount +=1; |
break; |
} |
if(compChoice 5){ //Rock vs Spock |
winner ='Computer'; |
winnerChoice =5; |
winningActionString = actionString[8]; //vaporizes |
compMoney += betPool; |
loser ='Player'; |
loserChoice =1; |
betPool =0; |
lossCount +=1; |
break; |
} |
case2: |
if(compChoice 1){ //Paper vs Rock |
winner ='Player'; |
winnerChoice =2; |
winningActionString = actionString[2]; //covers |
userMoney += betPool; |
loser ='Computer'; |
loserChoice =1; |
betPool =0; |
winCount +=1; |
break; |
} |
if(compChoice 2){ //Paper vs Paper |
winner ='Player'; |
winnerChoice =2; |
winningActionString = actionString[10]; //ties |
loser ='Computer'; |
loserChoice =2; |
tieCount +=1; |
userMoney += userBet; |
compMoney += compBet; |
betPool =0; |
break; |
} |
if(compChoice 3){ //Paper vs Scissors |
winner ='Computer'; |
winnerChoice =3; |
winningActionString = actionString[1]; //cuts |
compMoney += betPool; |
loser ='Player'; |
loserChoice =2; |
betPool =0; |
lossCount +=1; |
break; |
} |
if(compChoice 4){ //Paper vs Lizard |
winner ='Computer'; |
winnerChoice =4; |
winningActionString = actionString[6]; //eats |
compMoney += betPool; |
loser ='Player'; |
loserChoice =2; |
betPool =0; |
lossCount +=1; |
break; |
} |
if(compChoice 5){ //Paper vs Spock |
winner ='Player'; |
winnerChoice =2; |
winningActionString = actionString[8]; //disproves |
userMoney += betPool; |
loser ='Computer'; |
loserChoice =5; |
betPool =0; |
lossCount +=1; |
break; |
} |
case3: |
if(compChoice 1){ // Scissors vs Rock |
winner ='Computer'; |
winnerChoice =1; |
winningActionString = actionString[9]; // crushes |
compMoney += betPool; |
loser ='Player'; |
loserChoice =3; |
betPool =0; |
lossCount +=1; |
break; |
} |
if(compChoice 2){ // Scissors vs Paper |
winner ='Player'; |
winnerChoice =3; |
winningActionString = actionString[1]; // cuts |
userMoney += betPool; |
loser ='Computer'; |
loserChoice =2; |
betPool =0; |
winCount +=1; |
break; |
} |
if(compChoice 3){ // Scissors vs Scissors |
winner ='Player'; |
winnerChoice =3; |
winningActionString = actionString[10]; //Ties |
userMoney += userBet; |
loser ='Computer'; |
loserChoice =3; |
compMoney += compBet; |
betPool =0; |
tieCount +=1; |
break; |
} |
if(compChoice 4){ // Scissors vs Lizard |
winner ='Player'; |
winnerChoice =3; |
winningActionString = actionString[5]; // decapitates |
userMoney += betPool; |
loser ='Computer'; |
loserChoice =4; |
betPool =0; |
winCount +=1; |
break; |
} |
if(compChoice 5){ // Scissors vs Spock |
winner ='Computer'; |
winnerChoice =5; |
winningActionString = actionString[4]; // smashes |
compMoney += betPool; |
loser ='Player'; |
loserChoice =3; |
betPool =0; |
lossCount +=1; |
break; |
} |
case4: |
if(compChoice 1){ // Lizard vs Rock |
winner ='Computer'; |
winnerChoice =1; |
winningActionString = actionString[9]; // crushes |
compMoney += betPool; |
loser ='Player'; |
loserChoice =4; |
betPool =0; |
lossCount +=1; |
break; |
} |
if(compChoice 2){ // Lizard vs Paper |
winner ='Player'; |
winnerChoice =4; |
winningActionString = actionString[6]; // eats |
userMoney += betPool; |
loser ='Computer'; |
loserChoice =2; |
betPool =0; |
lossCount +=1; |
break; |
} |
if(compChoice 3){ // Lizard vs Scissors |
winner ='Computer'; |
winnerChoice =3; |
winningActionString = actionString[5]; // |
compMoney += betPool; |
loser ='Player'; |
loserChoice =4; |
betPool =0; |
lossCount +=1; |
break; |
} |
if(compChoice 4){ // Lizard vs Lizard |
winner ='Palyer'; |
winnerChoice =4; |
winningActionString = actionString[10]; // ties |
userMoney += userBet; |
loser ='Computer'; |
loserChoice =4; |
compMoney += compBet; |
betPool =0; |
tieCount +=1; |
break; |
} |
if(compChoice 5){ // Lizard vs Spock |
winner ='Player'; |
winnerChoice =4; |
winningActionString = actionString[3]; // poisons |
userMoney += betPool; |
loser ='Computer'; |
loserChoice =5; |
betPool =0; |
winCount +=1; |
break; |
} |
case5: |
if(compChoice 1){ // Spock vs Rock |
winner ='Player'; |
winnerChoice =5; |
winningActionString = actionString[8]; // vaporizes |
userMoney += betPool; |
loser ='Computer'; |
loserChoice =1; |
betPool =0; |
winCount +=1; |
break; |
} |
if(compChoice 2){ // Spock vs Paper |
winner ='Computer'; |
winnerChoice =2; |
winningActionString = actionString[7]; // disproves |
compMoney += betPool; |
loser ='Player'; |
loserChoice =5; |
betPool =0; |
lossCount +=1; |
break; |
} |
if(compChoice 3){ // Spock vs Scissors |
winner ='Player'; |
winnerChoice =5; |
winningActionString = actionString[4]; // smases |
userMoney += betPool; |
loser ='Computer'; |
loserChoice =3; |
betPool =0; |
winCount +=1; |
break; |
} |
if(compChoice 4){ // Spock vs Lizard |
winner ='Computer'; |
winnerChoice =4; |
winningActionString = actionString[3]; // poisons |
compMoney += betPool; |
loser ='Player'; |
loserChoice =5; |
betPool =0; |
lossCount +=1; |
break; |
} |
if(compChoice 5){ // Spock vs Spock |
winner ='Player'; |
winnerChoice =5; |
winningActionString = actionString[10]; // ties |
userMoney += userBet; |
loser ='Computer'; |
loserChoice =5; |
compMoney += compMoney; |
betPool =0; |
tieCount +=1; |
break; |
} |
} |
winnerImg = choicesImg[winnerChoice]; |
loserImg = choicesImg[loserChoice]; |
} |
publicvoidcreateWinnerPanel(){ |
} |
publicvoidcreateActionPanel(){ |
} |
publicvoidcreateLoserPanel(){ |
} |
publicvoidcreateDecisionContainer(){ |
} |
} |
LaunchGame.java
packageedu.witc.main; |
importjavax.swing.JFrame; |
importedu.witc.guts.DecisionPanel; |
publicclassLaunchGameextendsDecisionPanel{ |
publicstaticvoidmain(String[] args) { |
DecisionPanel newGame =newDecisionPanel(); |
newGame.setVisible(true); |
} |
} |
TheGame.java
packageedu.witc.guts; |
importedu.witc.guts.DecisionPanel; |
publicclassTheGame { |
} |
Making Rock Paper Scissors Game Java
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment