This site requires JavaScript, please enable it in your browser!
Greenfoot back
LearningProgramming
LearningProgramming wrote ...

2013/3/25

Rock, Paper, Scissor, Lizard, Spock

1
2
Does anyone have an idea how i could write a program that play this game against the computer and using java? Please i need help..
she53079 she53079

2013/3/26

#
Todos: Create a class for human player with an int field for his selection Do the same for a computer class Create clickable objects representing each of the options (rock, paper, scissor....a set for human player and a set for computer) When clicked an object is highlighted and human selection field should be updated corresponding click object Create a clickable object to trigger contests When clicked: generates random choice for computer and highlights his selection compare selection fields and update counter wins fields for humans or computers
What if am trying to do best of a number, say like best of 3 or 5 or 7
danpost danpost

2013/3/26

#
Add an instance field called 'bestOf' and set it to one of the values you suggested:
private int bestOf = 5; // as an example
Then if either 'humanWinCount' value or 'computerWinCount' value is greater than half the value of 'bestOf', then that player would be the winner of the set:
// with these instance fields to score wins
private int humanWins, computerWins;
// the check would be as follows
if (humanWins > bestOf/2 || computerWins > bestOf/2) Greenfoot.stop(); // example ending
Perform this check immediately after each game (when humanWins or computerWins is incremented). And instead of just stopping the scenario, you may want to splash a Game Over screen showing who won; then stop the scenario.
What about creating the entire game using eclipse, how do you go about that?
JetLennit JetLennit

2013/3/26

#
it depends... i know how to make it without graphics.. but i dont know with graphics.. please specify
JetLennit without graphics and also creating the best of series...
JetLennit JetLennit

2013/3/27

#
Best of series?
she53079 she53079

2013/3/27

#
Please start with this: http://docs.oracle.com/javase/tutorial/2d/basic2d/
JetLennit JetLennit

2013/3/27

#
!AAARGH!! am i the only one who doesn't know what best of series is? minus the arrrggghhh
danpost danpost

2013/3/27

#
You probably know what it means, but not making the connection to what is meant. An example of a 'best of' series is like the World Series in baseball, which is a best of 7 games (first one to win 4 , wins the series).
Exactly that is what i meant by Best of series...thanks danpost.. But you do get the point right?
danpost danpost

2013/3/27

#
LearningProgramming wrote...
What about creating the entire game using eclipse, how do you go about that?
I have not done any work with eclipse; nor do I have any knowledge along that line. Therefore, it would not be wise for me to try helping you in this area. However, if you need help with basic programming in Java, I may be able to assist you.
That would be nice i dont mind that I am having problem understanding the use of if-statements and so on...
danpost danpost

2013/3/27

#
You may want to check out the page in the Java tutorials on the 'if-then-else' clause. You may also find other useful tips throughout the trail (see the different subjects listed on the left pertaining to the basics of the Java language).
There are more replies on the next page.
1
2