Hot answers tagged

75 votes
Accepted

Monopoly simulator

You really need to remove some of your global variables. As an example I'd change all your browns to use a list instead. brown = [0, 0] As you do a lot of logic ...
Peilonrayz's user avatar
  • 42.7k
53 votes

A simple mastermind clone

This is sophisticated for a first attempt, but today would be a great day to break yourself of bad habits. Your code is full of them. Start with: format your code using standard formatting ...
Eric Lippert's user avatar
  • 14.7k
42 votes
Accepted

RPG Currency System

There's a few things that stand out to me: ...
Clockwork-Muse's user avatar
35 votes
Accepted

Bush Wanderer - code intended for teaching

Because the code you write is to be used for teaching, the importance is not on performance, but on correctness and readability and understandability (comphrensiveness?). So basically... Add ...
Pimgd's user avatar
  • 22.3k
35 votes
Accepted

Wordle Game clone

I appreciate you came here as a beginner and you're asking on how to improve. Not every developer wants to get feedback. I want to know if the way I programmed this game is efficient IMHO there is ...
Thomas Weller's user avatar
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
31 votes

RPG Currency System

public enum Coins Enum type names should be singular, unless they're decorated with a [Flags] attribute: Use Pascal case ...
Mathieu Guindon's user avatar
30 votes

A first "Hangman" game in Python

You define a clear_screen function, but then at the top you have ...
Carcigenicate's user avatar
29 votes
Accepted

The Mysts of Altair - text-based adventure game

There's a lot to comment on here, so I'll try to cover everything while being brief. Encapsulation ...
Barry's user avatar
  • 18.4k
29 votes

Monopoly simulator

You have a lot of verbose repetition, you should learn to simplify things with loops and functions. First, you're printing the board with each line getting a print statement, but you could just use a ...
SuperBiasedMan's user avatar
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
24 votes
Accepted

4x4 tic tac toe

Your code is quite good for someone who started 10 days ago. Here are a couple of improvements you should consider: Your code is hard to read due to inadequate indentation and spacing. Take a look at ...
hb20007's user avatar
  • 372
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.6k
24 votes
Accepted

2048 with GUI in C

Well done. This is not a complete review, but instead a (short) list of possible improvements I found when I skimmed your code. Documentation First of all: thank you! It's great to have ...
Zeta's user avatar
  • 19.2k
22 votes

Simple Python turn based battle game

f-strings Beginning with Python 3.6, there is a friendlier way of formatting strings. Instead of using "format string" % (tuple_of_args) where the argument and the ...
AJNeufeld's user avatar
  • 33.3k
21 votes

RPG Currency System

Are you sure that your business logic really needs to know about all those different types of coins? It feels like unnecessary complication to me. It should be a lot easier to maintain a code, that ...
Nikita B's user avatar
  • 13k
21 votes
Accepted

Pong game using SDL

Implementation Is it necessary to put the whole game execution into the Game constructor? (This will cause problems if you ever decide to inherit from ...
hoffmale's user avatar
  • 6,458
20 votes
Accepted

Game code optimisation advice

While reading your code I had one thought coming over and over: Get yourself acquainted with Object-Oriented Programming. Python allows you to build your own classes. Use that to your advantage. ...
Mast's user avatar
  • 13.1k
20 votes

Bush Wanderer - code intended for teaching

My main criticism is that the code is hard to follow because the variable names are cryptic and the logic is very if-else heavy. I understand your desire to avoid overwhelming your students with ...
200_success's user avatar
20 votes

Scrabble helper: find the highest score with any 7 letters

Your algorithm appears to be "generate all possible permutations of the tiles and check to see which are legal scrabble words". That's a very inefficient way to solve the problem. A better way is to ...
Eric Lippert's user avatar
  • 14.7k
19 votes
Accepted

Snakes Game Using ncurses

if(b) return false; else return true; With the ! operator, you can negate a boolean value. So by ...
Pimgd's user avatar
  • 22.3k
19 votes

A Simple Battleship Game

Magic Numbers Your biggest issue is too many magic numbers and hard-coded information. If you added at the top of your script: ROWS = 5 COLUMNS = 5 then you ...
AJNeufeld's user avatar
  • 33.3k
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
17 votes
Accepted

Monty Hall Simulation

Welcome to Code Review and coding in general: Code according to PEP8 – In your case this means using snake_case for variable and function names, add spaces after ...
holroy's user avatar
  • 11.5k
17 votes

A GameGrid class to hold the underlying data for grid-based game

For instance, a Console based game might use a char type for the cell value. Whereas, a form based game might use a Label. You seem to be mixing gameplay grids with layout grids. I strongly ...
Flater's user avatar
  • 5,532
17 votes

A dice game called "Greed"

Style You're not being charged by the character; there's no need to abbreviate "count", or "ret" (which I would call "score" instead). Also, main has inconsistent brackets with the rest of the ...
Errorsatz's user avatar
  • 1,354
17 votes

Chess game in C

Use enums to give names to numbers It would be great if you could write PAWN instead of 1, ...
G. Sliepen's user avatar
  • 50.2k
17 votes

Can I lessen the use of boolean flag variables in this snippet?

Can I lessen the use of boolean flag variables in this snippet? Consider 1st comparing. ...
chux - Reinstate Monica's user avatar
16 votes
Accepted

A game of nodes and pixels

I will only address the repetition in your collision detection code in this answer. The following lines of code are repeated several times: ...
Spike's user avatar
  • 1,423

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