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 ...
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 ...
42
votes
Accepted
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 ...
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 ...
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 ...
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 ...
30
votes
A first "Hangman" game in Python
You define a clear_screen function, but then at the top you have
...
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
...
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 ...
28
votes
Writing a clean implementation of rock–paper–scissors game in C++
Programming is the art of detecting and removing duplication.
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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♦
- 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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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.
...
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:
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
game × 1936python × 495
beginner × 419
java × 411
c++ × 301
javascript × 228
object-oriented × 206
c# × 195
python-3.x × 183
tic-tac-toe × 135
performance × 130
console × 99
playing-cards × 91
c × 71
rock-paper-scissors × 71
hangman × 64
random × 51
swing × 51
c++11 × 48
dice × 47
pygame × 46
snake-game × 46
algorithm × 44
objective-c × 44
community-challenge × 43