Skip to main content
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 ...
Jerry Coffin's user avatar
  • 33.6k
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! ...
Edward's user avatar
  • 66.6k
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 ...
Attilio's user avatar
  • 1,645
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 ...
Davislor's user avatar
  • 8,344
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 ...
301_Moved_Permanently's user avatar
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.
Rchn's user avatar
  • 221
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 ...
Curtis F's user avatar
  • 334
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. ...
Peilonrayz's user avatar
  • 43.5k
9 votes
Accepted

Convert image into ASCII art

myList should be my_list by PEP8. Add PEP484 type hints. from bisect import bisect_left ...
Reinderien's user avatar
  • 65.6k
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 ...
insertusernamehere's user avatar
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 ...
301_Moved_Permanently's user avatar
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: ...
alexwlchan's user avatar
  • 8,575
8 votes

Console-based table structure: Revisited

this->headers = {headers}; In the constructor? You mean to use an initializer instead :headers{headers} before the ...
JDługosz's user avatar
  • 11.3k
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 <...
Edward's user avatar
  • 66.6k
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 ...
Graipher's user avatar
  • 41.1k
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 ...
JDługosz's user avatar
  • 11.3k
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, ...
Dmitry's user avatar
  • 4,589
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: ...
301_Moved_Permanently's user avatar
7 votes

Console-based table structure: Revisited

Style (naming) The constructor could be improved. Instead of: ...
shycha's user avatar
  • 171
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 ...
301_Moved_Permanently's user avatar
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 ...
TorbenPutkonen's user avatar
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 ...
Joop Eggen's user avatar
  • 3,646
6 votes

Printing staircase revisited

This traditional Javascript code works fine: ...
Md. Jamal Uddin's user avatar
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 ...
Peilonrayz's user avatar
  • 43.5k
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 ...
Calak's user avatar
  • 2,371
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 ...
Peilonrayz's user avatar
  • 43.5k
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 ...
pacmaninbw's user avatar
  • 24.9k
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 ...
G. Sliepen's user avatar
  • 61.7k
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 ...
mfulton26's user avatar
  • 691
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 ...
rolfl's user avatar
  • 97.5k

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