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 ...
David Morris's user avatar
  • 1,018
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 ...
Edward's user avatar
  • 65.3k
34 votes
Accepted

My Rock, Paper, Scissors Game in Python

Cleanup For cleanliness: ...
Kraigolas's user avatar
  • 917
28 votes

Writing a clean implementation of rock–paper–scissors game in C++

Programming is the art of detecting and removing duplication. ...
Quuxplusone's user avatar
  • 19.3k
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 <...
Rob Audenaerde's user avatar
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 ...
SylvainD's user avatar
  • 29.2k
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 ...
Ralf Kleberhoff's user avatar
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: ...
Joe Greene's user avatar
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 ...
Levi Willrich's user avatar
12 votes

Rock, Paper Scissors game in Python

In Python you can compare multiple values the following way: ...
Zefick's user avatar
  • 331
12 votes

Rock Paper Scissors Lizard Spock

One Source of Truth Weapon.XXX.beats is redundant. Weapon.XXX.actions provides the same information. ...
AJNeufeld's user avatar
  • 33.3k
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's user avatar
  • 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 ...
Eric Stein's user avatar
  • 6,494
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 <...
Graipher's user avatar
  • 40.8k
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 ...
Marc's user avatar
  • 5,522
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 ...
Graipher's user avatar
  • 40.8k
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 ...
NonlinearFruit's user avatar
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. ...
user1118321's user avatar
  • 11.6k
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. ...
Ruslan's user avatar
  • 258
10 votes

Rock, Paper, Scissors in C++

In addition to Edward's answer. Use enum class instead of enum ...
Laurent LA RIZZA's user avatar
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 ...
user985366's user avatar
  • 1,695
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 ...
Gerrit0's user avatar
  • 3,456
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 ...
scohe001's user avatar
  • 358
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 ...
J_H's user avatar
  • 16.8k
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. ...
dshil's user avatar
  • 491
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: ...
πάντα ῥεῖ's user avatar
8 votes

RockPaperScissor Game

Passing class fields/properties as ref You're using ref to pass a variable and update it. ...
JAD's user avatar
  • 2,909
8 votes

Rock, Paper, Scissors Game - Basic Game Simulation

Java naming convention The method name should always start with a lower case. WelcomeP1 -> welcomeP1 ...
Doi9t's user avatar
  • 3,316
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/...
Martin York's user avatar
  • 94.3k
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... ...
Pimgd's user avatar
  • 22.3k

Only top scored, non community-wiki answers of a minimum length are eligible