Skip to main content
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.5k
33 votes
Accepted

Loading... animating dots in C

Too frenetic I ran your program but it was very frenetic. It was constantly clearing the "Loading" prompt and reprinting it which resulted in a flickering effect. In addition, the cursor also moved ...
JS1's user avatar
  • 28.6k
31 votes
Accepted

"Compliment giver" mini-program

Don't be discouraged by how much I have written. I'm a professional software developer and my colleagues make fun of me because of how pedantic my code reviews are. I think what you've done is ...
Ben Wainwright's user avatar
27 votes

Simple text-based RPG in Java

OOP This task really begs for object oriented programming. As a first step, I suggest moving the maxhp, playerhp, ...
janos's user avatar
  • 111k
24 votes

Dungeon Crawl game for the terminal

Overall, this is really well done. You've missed the usual traps of using magic numbers, not creating structures for related items, and other common things. So nice work! I think it could be improved ...
user1118321's user avatar
  • 11.7k
22 votes
Accepted

pyCMD; a simple shell to run math and Python commands

The first thing I notice with your code is that the code is a very long global script. To resolve this I'd start by moving your code into functions. The actual calculations could be as simple as say: <...
Peilonrayz's user avatar
  • 43.4k
21 votes
Accepted

List the movies I haven't seen

Welcome to codereview. Here are my suggestions: Functional decomposition and Naming The trickiest part of programming is to decouple your complex problem into smaller easier (sub)problems. It is ...
Peter Csala's user avatar
  • 9,486
19 votes
Accepted

A tic-tac-toe game in C

Unfortunately, it seems like you have stumbled across an older version of The C Programming Language which described a dialect of C now dubbed K&R C. K&R C was superseded by ANSI C (C89), and ...
Rish's user avatar
  • 2,436
18 votes

Dungeon Crawl game for the terminal

That's an awesome little game! User experience Before we dive into the code, let's talk about the game itself. Random hangs Sometimes, the executable hangs when I ...
Indiana Kernick's user avatar
18 votes

Tic-Tac-Toe for the terminal

First of all: nice work! It's easy to read and understand. Program organization It's very good that you split the task to small functions. Reading the body of main...
janos's user avatar
  • 111k
18 votes

Recreating Minesweeper

Overall Impression This code is not maintainable in its current state. Good code should always be maintainable. Code Readability The code is very difficult to read. This line of code in ...
pacmaninbw's user avatar
  • 24k
17 votes
Accepted

Python command-line program that generates passwords

Put all code in functions. Code in functions can be tested, experimented with, and reorganized much more easily than code floating around at the top level. Floating code introduces the temptation to ...
FMc's user avatar
  • 12.8k
16 votes
Accepted

Progress Bar in C++

I wrote a simple main() function to test this: int main() { show_progress_bar(100, "progress", '#'); } I ...
Toby Speight's user avatar
  • 79.3k
16 votes
Accepted

Conway's Game of Life Terminal Visualization in C

I'm impressed that this is your first project in C -- it's good! What follows are some comments on what's good that you should continue to do and then some suggestions for improvements. What's good? ...
Edward's user avatar
  • 66.5k
15 votes
Accepted

Minesweeper C++

C++ Vs C As has been said in the comments, your code reads very much like it's been written in C. You're using C functions like printf instead of the more C++ <...
forsvarir's user avatar
  • 11.7k
14 votes

A top-like live monitor for virsh/kvm/qemu VM's

Subprocess out, _ = subprocess.Popen(['virsh', command, arg], stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate() is a little clunky; consider ...
Reinderien's user avatar
  • 63.1k
14 votes
Accepted

Tic-Tac-Toe code using c#

Choosing good identifiers When I see a name like options I think of something a player can choose from like "single player" (i.e., play against the ...
Olivier Jacot-Descombes's user avatar
14 votes

Python command-line program that generates passwords

I feel like you came up with an over-engineered solution that, ultimately, fails to meet expectations. Generating a password is a task with well-defined use-cases, that we encounter almost daily. Most ...
gazoh's user avatar
  • 3,359
13 votes
Accepted

Counting density of Python code

The docstrings are vague. Documentation needs to be precise and complete. It should answer questions like "what arguments should I pass?" and "what does it return?" For example, "go through the AST ...
Gareth Rees's user avatar
  • 49.7k
13 votes
Accepted

Console calculator for 2 numbers at a time

Some rules of thumb: If you have your entire program in a single method (Main(), in this case), there are some design considerations you should probably revisit. ...
Jesse C. Slicer's user avatar
12 votes

Loading... animating dots in C

You can get rid of that flickering green box by disabling the cursor. fputs("\e[?25l", stdout); /* hide the cursor */ If you want it back, you can re-enable it. ...
syb0rg's user avatar
  • 21.8k
12 votes

Dividing two numbers then handle the divide by zero exception with try/catch

If you know that you want to divide two numbers then IMHO it would make more sense to perform a pre-liminary check. In other words, rather than executing the operation "blindly" by trusting ...
Peter Csala's user avatar
  • 9,486
12 votes
Accepted

Currency Converter (calling an api in c#)

Don't use double for currency The double type can't accurately represent base-10 decimal numbers. This is fine for a lot of ...
gazoh's user avatar
  • 3,359
12 votes
Accepted

Terminal based game

Use a curses library or something similar There are many details to worry about when writing low-level terminal code. I strongly recommend you use a library that takes away that burden, and that will ...
G. Sliepen's user avatar
  • 60.1k
11 votes

Battleship console game

Here are a number of things that may help you improve your program. The other reviews have provided some good points, so I'll try not to duplicate what's already written there. Only use ...
Edward's user avatar
  • 66.5k
11 votes

Simple text-based RPG in Java

Some of your switch cases are unnecessarily long, repetitive and include lots of code. You could easily replace them with indexed arrays, making it easier to read, shorter, and easier to expand with ...
user985366's user avatar
  • 1,735
11 votes
Accepted

Text-based User Interface in Python

General Try to comply with PEP-8. PEP-8 is the name of the official Python style guide. Complying with it makes your code easier to read. Ultimately, developers can more easily collaborate on a ...
Daniel's user avatar
  • 4,500
11 votes
Accepted

Console snake game in C#

Well, this is my first code review and by no means I'm an C# expert or something like that, but anyways I'd like to give a general opinion about your code. First and foremost, you're using C# which ...
Xam's user avatar
  • 365
11 votes

Repetitive validation of Console inputs

As you suggested, you have a lot of redundant code. And rightfully so you want to adhere to the DRY principle. All these input methods have the same pattern internally.. ...
dfhwze's user avatar
  • 13.9k

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