Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
35 votes
Accepted

The right way to hang a man

Repetitions All your elif share the same structure. You just need to ensure that the inserted pattern is always 3 wide and you can drop your offsets adjustments. ...
301_Moved_Permanently'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
24 votes
Accepted

Beginners Python Hangman Code

Welcome to Python, and welcome to Code Review! Here are some basic tips to help you along. 0.5. EDIT: I think you also have an unused import. import string is not ...
omgimanerd's user avatar
  • 1,135
16 votes
Accepted

My first Hangman game in Python

While it's clear that you're new to python, it's still pretty good that you got it to run first time. Good job! Input Validation Currently, you have a list of forbidden characters. While that can ...
Gloweye's user avatar
  • 1,746
15 votes
Accepted

C++ Hangman Game

Prefer '\n' to std::endl The only difference is that std::endl will flush the stream after ...
Martin York's user avatar
  • 95.2k
14 votes

Hangman Game with C++

I will proceed from a high level to a low level perspective. Starting with main.cpp: Game pass; pass.onOffSwitch("close"); The meaning of these two lines are ...
Raimund Krämer's user avatar
14 votes

A first "Hangman" game in Python

It's not that great of an optimization but if you're new to programming it can be interesting to consider something along the line of : ...
Nomis's user avatar
  • 354
13 votes

Hangman Game with C++

Single Responsibility Principle The class Game does too much directly, this could be an aggregation of classes instead. One of the points of the Single Responsibility Principle is that a class or ...
pacmaninbw's user avatar
  • 23.8k
11 votes
Accepted

Simple Python hangman game

Overview I can see that you are a beginner and that is totally fine! Some of the points I will be making might, sound a bit harsh and go over your head. If they do try to improve the parts of the ...
N3buchadnezzar's user avatar
11 votes
Accepted

Hangman Bot built with performance in mind

The SIMD code has type errors. The problem is currently a bunch of floats are read, assigned to a SIMDi anyway, added as floats (and remember, these were integers, ...
user555045's user avatar
  • 9,794
9 votes

Find all words that satisfy unknown letters (Hangman)

The solution would indeed be much simpler using regular expressions. The trick is to build the regular expression dynamically, using a negated character class like ...
200_success's user avatar
9 votes

Hangman Bot built with performance in mind

The only obvious thing I see is that your realloc machinery is too complicated given the task at hand. Your entire word file is only 530 KB. You could easily ...
Reinderien's user avatar
  • 62.1k
9 votes
Accepted

Hangman game in Python with nine possible words

This looks pretty good for 1-month coder. Keep it up! Use functions, classes and tests If you have already learned them - use them. If you haven't - learn them. Start with functions. They are in the ...
Pavlo Slavynskyy's user avatar
8 votes

Hangman from a beginner

That's so awesome you are learning Python! I love it and I am sure you will too. Your code looks pretty good! I played it and enjoyed doing so. It's harder than I expected though! So here are a few ...
Projski's user avatar
  • 171
8 votes
Accepted

Simple Hangman game in Python

For this, I am going to go through your program in the order it is written: Don't use if twoplayer == False:. You can simply say ...
zondo's user avatar
  • 3,797
8 votes
Accepted

Hangman implementation for teaching a Python course

I could come up with a laundry list of improvements. However, I would like to focus on just one issue, which makes your code an unforgivably bad example for your students: you are misusing functions ...
200_success's user avatar
8 votes

A first "Hangman" game in Python

Clearing the screen os.system('cls') is a horrible way of clearing the screen. The cross-platform ...
AJNeufeld's user avatar
  • 33.7k
8 votes

Hangman Game (YAHG)

1. Use classes to separate concerns One improvement could be to introduce your own classes to separate the hangman drawing, from the main game loop. Something like ...
πάντα ῥεῖ's user avatar
8 votes

Hangman Bot built with performance in mind

There is no need to implement stringEqual yourself. Use strcmp(a, b) == 0 instead. For all variables that contain memory sizes, ...
Roland Illig's user avatar
  • 21.3k
8 votes

OOP Hangman Game

From the first looks, quite nice. I have mostly just a few smaller concerns: Consistency matters for readers, so should be either x = y, ...
ferada's user avatar
  • 11.1k
7 votes

Hangman learning AI

Here are a few general feedbacks: Have a coherent code style You're mixing multiple code styles sometimes you put spaces around operators ng-show='step == 0', ...
Volune's user avatar
  • 171
7 votes

Simple Hangman game in Java

Just quickly, here's some feedback: I think your set up code is fine (where you're creating the JFrames etc), it's very boiler platey, but that's java. But you shouldn't put that logic in the ...
dwjohnston's user avatar
  • 1,308
7 votes

Hangman in Python 3

Good work! I applaud you on maintaining readability and having a compartmentalized, functional program. From a glance I suggest this: Lines 32 and similar input()'...
Sank Finatra's user avatar
7 votes
Accepted

Hangman game, written after taking a Python course

Your code structure is one of infinite recursion. Main() calls placeholder(), which calls ...
AJNeufeld's user avatar
  • 33.7k
7 votes

Hangman Game (YAHG)

Welcome to Code Review! On my first scan through the code I was impressed. I learned a new C++ STL library function, std::transform(). I was really glad to see that there was no ...
pacmaninbw's user avatar
  • 23.8k
7 votes
Accepted

Removing OO style coding from Haskell

Prelude First of all, good work! I can see the effort you put into grokking something so foreign, and I would like to commend you for it. I will be focusing on reviewing what I think you can improve, ...
cole's user avatar
  • 616
7 votes

First Hangman Game. Need Honest Opinion

Currently, you have print statements mixed throughout your game logic. I would suggest separating your code into the part that decides what to do with the latest input, and the part that prints a ...
alexanderbird's user avatar
7 votes

First Hangman Game. Need Honest Opinion

If a function just calls another function, delete one of them. You don't need both main() and testing(), since the former does ...
FMc's user avatar
  • 12.7k
7 votes
Accepted

Hangman game in C

General Overview This is pretty good for a beginner. I see some best practices are already being followed such as placing single statements in an if statement ...
pacmaninbw's user avatar
  • 23.8k

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