34
votes
Accepted
Rock-Paper-Scissors game for learning purposes
Choice representation
You're using numbers to represent choices (rock/paper/scissors). That's a reasonable choice, but as it stands, you have the mapping between choices and numbers smeared all ...
34
votes
Accepted
Rock, Paper, Scissors in C++
It's a good start! Here are some things that may help you improve your program.
Don't abuse using namespace std
Putting ...
34
votes
Accepted
28
votes
Writing a clean implementation of rock–paper–scissors game in C++
Programming is the art of detecting and removing duplication.
...
19
votes
Rock Paper Scissors game using OOP
Good job so far!
The previous answers already cover a lot, I just want to add this:
Don't use String for state!
Currently you use String to encode the Players <...
18
votes
Accepted
Stone, Paper, Scissors in Python
Little issues
Your indentations seems wrong : too many spaces in a few places, not enough in a few other places. Whitespaces matter in Python so this is definitly something you should fix before ...
14
votes
OOP implementation of Rock Paper Scissors game logic in Java
I don't see anything object-oriented in it. A program without a single non-static method can hardly be called OO.
The main task of this piece of code is to compare ...
13
votes
Accepted
A Simple Rock, Paper, Scissors program
From the top:
Imports
Since you're only using one thing from random, you might as well only import that one thing:
...
13
votes
First attempt: Python Rock Paper Scissors
This code reads like beginner code. Good beginner code, but there are a few habits you're getting into that are systemic among beginners and will screw you over later down the line.
First, your ...
12
votes
Rock, Paper Scissors game in Python
In Python you can compare multiple values the following way:
...
12
votes
Rock Paper Scissors Lizard Spock
One Source of Truth
Weapon.XXX.beats is redundant. Weapon.XXX.actions provides the same information.
...
12
votes
Please harshly judge my C++ Rock Paper Scissors
There's good news and bad news. The good news is that it looks fairly complete. The bad news is that it's overly long, hard to read, lacking in consistency, and doesn't make sense in a lot of places.
...

Mast♦
- 13.1k
11
votes
Rock, Paper, Scissors 3-part
Naming
Java classes start with a capital letter and do not use underscores, so rock_paper should be RockPaper. Java uses ...
11
votes
Stone, Paper, Scissors in Python
Here is a go on getting rid of a lot of the repetition.
A side note: In English this game is traditionally called "Rock, Paper, Scissors"
Your functions SPC and <...
11
votes
Accepted
OOP implementation of Rock Paper Scissors game logic in Java
The code looks fine, few suggestions:
Typo: winer should be winner.
Naming: since the variable ...
10
votes
Accepted
Rock, Paper, Scissors - Python game
Like @wb9688 mentioned in the comments, the way you currently determine the winner is fine and working, but it does not scale very well. If you wanted to add two more possible moves (for example ...
10
votes
Rock, Paper Scissors game in Python
Here are 3 corrections. Instead of manually converting r,s,p and 1,2,3, use a dictionary. Instead of using a random number for ...
10
votes
Accepted
Rock Paper Scissor Code
I built this and played it. I managed to win a few times! Good times.
Overall, the code is straightforward and easy to understand, so props on that. Here are a few things that could use improvement.
...
10
votes
Accepted
Rock-paper-scissors console implementation
I'll go through your code and give comments on some chunks of it. Horizontal lines separate the discussion of different chunks.
...
10
votes
10
votes
Rock, Paper, Scissors Game - Basic Game Simulation
Code formatting
You have some formatting and indentation problems. Please run your code through a formatter, for example this one
https://www.tutorialspoint.com/online_java_formatter.htm
to make it ...
9
votes
Rock Paper Scissors game using OOP
This code really isn't a mess! While there are a few relatively minor points I can make, your code is generally easy to read and understand, and there's nothing horribly wrong about it.
Watch out for ...
9
votes
Rock, Paper, Scissors in C++
One more suggestion to add on top of these already great answers.
In the vein of "being nicer to your users," instead of
...
9
votes
Rock, Paper, Scissors game with CPU
int games_number = 0, games_played = 0, user_wins = 0, computer_wins = 0, even_games = 0; //Counters
Wow, that's a lot of counters!
When choosing a data ...
8
votes
Let's play Rock, Paper, Scissors
First up, I read carefully your question and found a string 'I have a lot of if statements'.
Perfomance Issue
Unnecessary if checks
Lets look deeply in your code.
...
8
votes
Rock-paper-scissors console implementation
As you are asking for using more c++11 features specifically.
1. Use raw string literals
The way you are printing your banner looks clunky, and is hard to maintain:
...
8
votes
RockPaperScissor Game
Passing class fields/properties as ref
You're using ref to pass a variable and update it.
...
8
votes
Rock, Paper, Scissors Game - Basic Game Simulation
Java naming convention
The method name should always start with a lower case.
WelcomeP1 -> welcomeP1
...
8
votes
Accepted
"Rock Paper Scissors" game
Overview
I don't like how you are simply passing strings around for the values. Its simple but not very optimal. I would create some enum types to represent the different states (Win, Lose, Draw) and/...
7
votes
Rock-Paper-Scissors game for learning purposes
You'd do well to use an enum or constants for your rock, paper and scissors.
For instance, what you've got here...
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
rock-paper-scissors × 174python × 75
game × 71
beginner × 69
python-3.x × 35
c++ × 27
object-oriented × 24
java × 23
javascript × 20
c# × 17
community-challenge × 16
python-2.x × 5
console × 5
rags-to-riches × 4
performance × 3
c++11 × 3
ruby × 3
jquery × 2
html × 2
.net × 2
haskell × 2
ecmascript-6 × 2
homework × 2
c++17 × 2
classes × 2