Skip to main content
19 votes
Accepted

A tic-tac-toe game in C

Unfortunately, it seems like you have stumbled across an older version of The C Programming Language which described a dialect of C now dubbed K&R C. K&R C was superseded by ANSI C (C89), and ...
Rish's user avatar
  • 2,361
18 votes

Recreating Minesweeper

Overall Impression This code is not maintainable in its current state. Good code should always be maintainable. Code Readability The code is very difficult to read. This line of code in ...
pacmaninbw's user avatar
  • 24k
16 votes
Accepted

Conway's Game of Life Terminal Visualization in C

I'm impressed that this is your first project in C -- it's good! What follows are some comments on what's good that you should continue to do and then some suggestions for improvements. What's good? ...
Edward's user avatar
  • 66.5k
12 votes
Accepted

Terminal based game

Use a curses library or something similar There are many details to worry about when writing low-level terminal code. I strongly recommend you use a library that takes away that burden, and that will ...
G. Sliepen's user avatar
  • 58.8k
10 votes

Conway's Game of Life Terminal Visualization in C

I can't (yet?) comment on the (excellent) first answer, or I would. But I have a few comments to add to what has already been said: In Unix you don't need to check the result of malloc, if having the ...
jimc's user avatar
  • 101
9 votes

Recreating Minesweeper

Don't use system("cls") Clearing the screen this way is very inefficient: it creates a new process running cmd.exe, which in turn has to interpret the ...
G. Sliepen's user avatar
  • 58.8k
8 votes

C# console app that draws an image to the console using ASCII

Disclaimer: I could not either run it locally (because I'm working on a Mac) or via dotnet fiddle (which works on some Linux distro) because Gdip threw a ...
Peter Csala's user avatar
  • 9,373
7 votes

CAT: Cat Approved TUIs

You appear to be asking for a review the part of the code you posted, not the library itself. (ETA: I wrote this before you posted any of the library code.) I’m not sure how useful that will be, but ...
Davislor's user avatar
  • 8,071
7 votes

C# console app that draws an image to the console using ASCII

I'm semi-new to programming and want to improve my skills by understanding how people might optimize their code and how the code should be structured Excellent. First bit of advice: Always start with ...
Eric Lippert's user avatar
  • 14.9k
7 votes
Accepted

Simple size difference measuring tool

modern annotation We used to have to do this: from typing import List But in a modern interpreter like 3.11 we prefer to just say ...
J_H's user avatar
  • 30.8k
7 votes

Battleship vs. computer with Python

Use more vertical whitespace: It seems as if the code was manually formatted. Consider using black or ruff to format the code ...
Harith's user avatar
  • 9,462
6 votes

CAT: Cat Approved TUIs

Unfortunately you've only shown some of the header files, but no concrete implementation of your TUI library, so I cannot meaningfully review that. However, we can look at your intended use of the TUI....
G. Sliepen's user avatar
  • 58.8k
6 votes

A tic-tac-toe game in C

Advice I - stdio.h: I was able to compile your code in Visual Studio only via adding #include <stdio.h>. Please, add it to ...
coderodde's user avatar
  • 28.9k
5 votes
Accepted

A Python terminal

.pylect.password.py Your file naming is non-standard. I have some concerns with prefixing python files with ., and using ...
Peilonrayz's user avatar
  • 43.4k
5 votes
Accepted

Little CLI game in C++ with random words

General Observations An interesting new twist on an old game! Using Wikipedia as a source gives a lot of possible words. There is a lot of good ideas here, but there can be some improvement. An ...
pacmaninbw's user avatar
  • 24k
5 votes
Accepted

Calling the base method from overriden method to add some functionality

When you Generate an override in Visual Studio, a call to the base method is automatically added. This is quite a common way to extend the behavior of a method. If you do not call the base method, you ...
Olivier Jacot-Descombes's user avatar
5 votes

Reassure user that python code is running during long imports

A strange game. The only winning move is not to play. -- War Games, Joshua / WOPR I don't know what your set of imports is. ... the user sits in front of an ...
J_H's user avatar
  • 30.8k
5 votes

Rust: Command line menu in ASCII table

Separate main program and library Currently you have everything in one unit file. This is fine for small applications that don't do much, but it will decrease re-usability of your code. Make your code ...
Richard Neumann's user avatar
5 votes
Accepted

Text based tic-tac-toe in bash

The intent here is that an engineer who is not a Bash expert should be able to readily maintain the code some months down the road. I do not know much about bash You might be that future maintenance ...
J_H's user avatar
  • 30.8k
5 votes
Accepted

Simple Java Command-line Checkers Game

Use Java 16 Records Coordinate is a typical transparent data-carrier. record Coordinate(int row, int col) { } Apply Information expert principle ...
Alexander Ivanchenko's user avatar
5 votes
Accepted

A simple ray marcher for the command line

Prefer static inline functions to macros: #define V3(X, Y, Z) (struct vector3d) {.x = X, .y = Y, .z = Z} is better as: ...
Harith's user avatar
  • 9,462
5 votes

A simple ray marcher for the command line

float vs. double Avoid mixing types of functions for no gain. ...
chux - Reinstate Monica's user avatar
4 votes

A very basic calculator in C#

static void Main(string[] args) In C# you can change the Main method's signature to one of the followings depending on your ...
Peter Csala's user avatar
  • 9,373
4 votes

Terminal based game

Unless there is some game timer event pending (like if it's not just turn-based, or you have some kind of animation), then the appropriate timeout for select is ...
Peter Cordes's user avatar
  • 3,346
4 votes
Accepted

Terminal based game: Part 3 (Using templated game)

Just make a runGame() function You want to avoid classes, but you are still introducing one here: a GameTemplate object is ...
G. Sliepen's user avatar
  • 58.8k
4 votes
Accepted

Linux terminal like parsing

Handle input correctly Your implementation does not handle an empty string correctly (based on the commented out cmd := input[0], which will panic). The input-...
Rish's user avatar
  • 2,361
4 votes

Display summary statistics about Discord messages

Yes, as you have indicated, the very first step should be to split your code into dedicated modules. Almost all of your methods are used only once. A very natural split could be to encapsulate those ...
Peter Csala's user avatar
  • 9,373
3 votes
Accepted

Thread-safe int wrapper in c#

Based on the discussion in the comments section I think the code can be greatly simplified: ...
Peter Csala's user avatar
  • 9,373
3 votes

Parametric - a simple program argument parser

Design review I’ve never seen a command-line parser that treats the command line as a tree, but I think it’s brilliant. It’s one of those things that, now that I’ve seen it, I can’t imagine how I ever ...
indi's user avatar
  • 12k

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