Skip to main content
41 votes

Rock Paper Scissors. My first C++ program. Please judge harshly

It's not too terrible, especially for a first program, but there are a number of things that you might improve. Decompose your program into functions Almost all of the logic here is in ...
Edward's user avatar
  • 66.4k
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
  • 66.4k
34 votes
Accepted

My Rock, Paper, Scissors Game in Python

Cleanup For cleanliness: ...
Kraigolas's user avatar
  • 927
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.4k
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
15 votes

Rock Paper Scissors. My first C++ program. Please judge harshly

seed once srand(time(nullptr) + num); You're seeding the PRNG on each call. Don't do that. One time, in main, suffices. As ...
J_H's user avatar
  • 28.8k
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.7k
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.4k
12 votes

Rock Paper Scissors. My first C++ program. Please judge harshly

Make use of the latest standard C++ is an evolving language, and a new version of the C++ standard is released every 3 years or so. Each new version aims to make life simpler and better for the ...
G. Sliepen's user avatar
  • 58.3k
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
  • 41k
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,604
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, 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
  • 41k
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.7k
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,725
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
  • 28.8k
9 votes

Rock Paper Scissors. My first C++ program. Please judge harshly

Make it a habit to comment your program. What does it do, when did you write it, what are the prerequisites, what is the target system, how do you build it? Make it a habit to comment your functions. ...
Peter - Reinstate Monica's user avatar
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,919
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,326

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