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. ...
30
votes
A first "Hangman" game in Python
You define a clear_screen function, but then at the top you have
...
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 ...
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 ...
15
votes
Accepted
C++ Hangman Game
Prefer '\n' to std::endl
The only difference is that std::endl will flush the stream after ...
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 ...
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 :
...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
8
votes
Accepted
HangPerson in Haskell
While your code might be working and written in a functional language, it also feels very procedural to me. Most idiomatic Haskell code I see has a very high signal to noise ratio. In your code I have ...
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 ...
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 ...
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 ...
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 ...
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
...
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, ...
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, ...
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 ...
7
votes
Accepted
Python Hangman Game
Input checking
The way you're currently checking input is clunky, hard to write, and hard to read. For example, you have the following chunk of code:
...
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', ...
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()'...
7
votes
Accepted
Hangman game, written after taking a Python course
Your code structure is one of infinite recursion. Main() calls placeholder(), which calls ...
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 ...
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, ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
hangman × 201python × 96
beginner × 72
game × 64
python-3.x × 49
java × 41
c++ × 23
object-oriented × 20
console × 14
performance × 13
python-2.x × 11
javascript × 8
c × 7
c# × 5
haskell × 5
functional-programming × 4
rust × 4
swing × 4
ascii-art × 4
strings × 3
c++11 × 3
homework × 3
php × 2
programming-challenge × 2
html × 2