47
votes
Accepted
ASCII text-based RPG game in C++
First of all, let me join others in pointing out what sweet ASCII art you've done. This definitely has the beginnings of a much nicer text game than most.
I'd start by defining some structures to ...
29
votes
ASCII text-based RPG game in C++
There's good news and bad news about this code. The bad news is that it's not very good code. The good news is that it's not going to be too hard to improve it greatly, and the ASCII art is awesome! ...
17
votes
Accepted
Printing binary trees
First of all, in my opinion, both the algorithm is nice and interesting, and the code is really well-written, broken down into easily understandable functions!
Well done!
The only addition that I can ...
16
votes
ASCII text-based RPG game in C++
Control Flow
I want to endorse and flesh out a bit Edward’s advice on removing the goto statements. A better approach here is some kind of state machine. You’ve ...
16
votes
Generate an Hour Glass pattern
Read PEP8, it will give you directions on how to write Python code that look like Python code to other.
Other than that, the behaviour you're seeking is already implemented in ...
12
votes
ASCII text-based RPG game in C++
You might want to load the ascii art from separate text files so you can edit those without messing with the functional code.
12
votes
Accepted
Printing a multiplication table in C
You should generally try to avoid global variables (like tableSize). Since they can be used everywhere ("globally"), at the worst case you need to read all of the ...
9
votes
Accepted
Printing a diamond shape in ASCII
Calling print is very slow, you should focus on building strings then have one print. Fortunately Python has some really nice string manipulation options.
...
9
votes
Accepted
Convert image into ASCII art
myList should be my_list by PEP8.
Add PEP484 type hints.
from bisect import bisect_left ...
8
votes
Accepted
Print a chessboard
First of all, your code has a little flaw. It will print the first two lines like this:
◼◻◼◻◼◻◼◻
◼◻◼◻◼◻◼
You may haven't noticed it, because it's hard to spot ...
8
votes
Accepted
Python ASCII-Art Table
There are a lot of duplicated code, inefficiencies and redundancies (wait…) but there is that one thing that you are doing right: you use join instead of trying to ...
8
votes
Python ASCII-Art Table
In no particular order:
Your approach to default keyword arguments with the **k is unusual. I’d expect to see something more like:
...
8
votes
Console-based table structure: Revisited
this->headers = {headers};
In the constructor? You mean to use an initializer instead
:headers{headers}
before the ...
8
votes
Accepted
Console-based table structure: Revisited
This version is definitely much improved. Good job! I see a few things that might help you improve it even further.
Use all required #includes
The code uses <...
8
votes
Pretty printing of the numpy ndarrays
If A.ndim is not in 1, 2, 3, your code tries to return a non-existing string s. It would be ...
8
votes
Accepted
Output a pyramid of numbers
Don’t write using namespace std;.
You can, however, in a CPP file (not H file) or inside a function put individual ...
7
votes
Accepted
Show a diamond shape with numbers
Code issues that decrease readability and maintainability
Plenty of loops.
Non-meaningful variable names: n, l, ...
7
votes
Accepted
Python ASCII-Art Text Generator
Style
You’ve already been told that by @alexwlchan in your previous question but: "whitespace is cheap" and it improves readability a lot. Compare your code to:
...
7
votes
Console-based table structure: Revisited
Style (naming)
The constructor could be improved. Instead of:
...
7
votes
Accepted
Pythonic way to draw ascii christmas tree?
Out of your defaults, only the minimal height have some relevance. The others can be deduced from it or are fixed computations that can be baked into the logic of a function.
I will also strongly ...
7
votes
Accepted
Java - Converting a skip list to the ASCII art
"Obviously" no pretty string formatting belongs in the SkipList data structure. That is just a big single responsiblity principle violation. The question ...
7
votes
Java - Converting a skip list to the ASCII art
The automatically found imperfections in SkipList:
unused import statement import java.util.Random;.
equals should check the ...
6
votes
6
votes
Circles of numbers
I'd recommend you start over. I always start patterns that are mirrored in the x axis by figuring out how to do a quarter of the pattern.
I also use a view, so that if you want to change the icons you ...
6
votes
Accepted
Printing concentric squares of numbers
Use a bit more spaces. It will make your code more readable.
Try to be coherent with your indents
You should sanitize input. What happen if user enter a number greater than 9 ? Or 0, 1, or 2? Or ...
6
votes
Recreate Mario's half-pyramids using hashes (#) from CS50
Your code is quite nice. Your use of functions seem quite reasonable. And your style is nice too. Good job!
Calling print is expensive. To improve performance we ...
6
votes
Accepted
ASCII Random Walk Algorithm
General Observations
Welcome to code review, nice first question. I would leave the licensing information out since stack exchange uses the Creative Commons Attribution-ShareAlike license.
The comment ...
6
votes
ASCII Random Walk Algorithm
Don't use system() for trivial tasks
Calling system() means starting a new shell process, which in turn has to parse the command ...
5
votes
Accepted
Christmas Tree in Kotlin
"args" is more common and descriptive than "a" in a main function signature
"\n" is system-dependent; I recommend using ...
5
votes
Building Better Boxes
Your friend is right, and there's ways to parameterize the code to make it more useful. Consider three things:
Don't print each character - build a block of text up, and print the block (note that ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
ascii-art × 154python × 47
beginner × 36
java × 28
c++ × 20
python-3.x × 19
c × 16
formatting × 16
programming-challenge × 14
python-2.x × 14
console × 11
javascript × 8
performance × 8
haskell × 8
fractals × 8
algorithm × 7
c# × 6
data-visualization × 6
array × 5
strings × 4
game × 4
homework × 4
hangman × 4
object-oriented × 3
recursion × 3