I have a code for rock paper scissors game , but this is only single player game and i want to develop it for multilayer
can any one help me for that logic?
my single player game code is
kindly help me for that.....
Niall Loughnane
Ranch Hand
Joined: Dec 07, 2006
Posts: 200
posted
0
Hi,
An idea,
You could:
- refactor the code and store the session information variables in a Data Transfer Object (DTO)
- when the game starts running, ask the user initially how many players there are playing
- store the number of players in a Map
- run through the Map for each user and let the user have fun playing the game
Hope it helps,
Niall
ameya disuja
Greenhorn
Joined: Apr 23, 2012
Posts: 2
posted
0
can you please explain in details ?
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32654
4
posted
0
Welcome to the Ranch
I think you ought to use an enum for the game. Not only can you say == ROCK, but you can also have loses to paper and wins over scissors in that object. There is a lot of non-object-oriented code in that main method. You should have a Player class with scores as a field. Please search; similar problems come up reasonably frequently.