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
17 votes

Can I lessen the use of boolean flag variables in this snippet?

Can I lessen the use of boolean flag variables in this snippet? Consider 1st comparing. ...
chux - Reinstate Monica's user avatar
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.3k
10 votes

Can I lessen the use of boolean flag variables in this snippet?

I'm not familiar with unity so, I can't review your code from that perspective. But we can certainly make this code more concise. Let me show you how to get started with refactor this code. 1. Get rid ...
Peter Csala's user avatar
  • 9,279
10 votes

Can I lessen the use of boolean flag variables in this snippet?

Each call to handleInputEvents() can set bShow to a new boolean value. We could approach the display update task by making a truth table. ...
J_H's user avatar
  • 28.9k
10 votes
Accepted

Text-mode 2048 in Python (using numpy)

Yay! Modules have docstrings, excellent. And same for classes. Recommend that you routinely include .idea/ in .gitignore, so ...
J_H's user avatar
  • 28.9k
10 votes
Accepted

Python Breakout game

Wow, no import pygame, this is strictly a colorful curses project. A bold design move! The animated demo image looks great. As does the source code. old-style ...
J_H's user avatar
  • 28.9k
9 votes
Accepted

Space shooter game using pygame

The graphics are beautiful. I appreciate the attention to details, like the background stars. assets directory This certainly is not bad: ...
J_H's user avatar
  • 28.9k
8 votes
Accepted

"Rock Paper Scissors" game

Overview I don't like how you are simply passing strings around for the values. Its simple but not very optimal. I would create some enum types to represent the different states (Win, Lose, Draw) and/...
Loki Astari's user avatar
  • 95.2k
7 votes

Can I lessen the use of boolean flag variables in this snippet?

Why don't you make button.show() simply do an early exit if the visibility state being passed in is already the same? I'm surprised it doesn't already work this ...
selbie's user avatar
  • 195
7 votes
Accepted

Event System using C++

Avoid macros There are many issues with macros, the general advice is to avoid them where possible. Let's look at EVENT_TYPE_FUNCTION(): it's there to add a few ...
G. Sliepen's user avatar
  • 58.3k
7 votes

"Rock Paper Scissors" game

Computing pcSelection can be factored out into a separate function. If users enter an invalid choice, promptUserInput still ...
Ajay Theetharappan's user avatar
7 votes
Accepted

DIY Sudoku Solver (Windows Console App)

About your own points This has been written for my antiquated C++ compiler, but is really a C Windows Console app. (The old compiler allowed variables to be defined close to use, rather than grouped ...
G. Sliepen's user avatar
  • 58.3k
6 votes

Event System using C++

General Observations This code review request does not present any C++ source files (.cpp files). It appears that you are trying to write close code without the <...
pacmaninbw's user avatar
  • 23.9k
6 votes

Here is a Tic Tac Toe game in Python using functions

I would say you did an excellent job overall! The only suggestions I would make are: The User Is Capable of Entering Unexpected Input You have: ...
Booboo's user avatar
  • 1,686
6 votes

Can I lessen the use of boolean flag variables in this snippet?

Since this is tagged unity3d, rather than setting a flag somewhere else in the script, you can just do the following: ...
crass_sandwich's user avatar
6 votes

Text Game project for IT 140

Wow, this is pretty good! shadowing a warning on Pycharm for "Shadows name 'current_room' from outer scope" ... but I haven't seen it create any issue so far when running the game. You ...
J_H's user avatar
  • 28.9k
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.7k
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
  • 23.9k
5 votes
Accepted

Recreated Snake in Rust

Clippy One of the most important tools when writing good rust code is clippy. I recommend to configure your editor to run clippy on-the fly. It has very nice messages and includes an explanation for ...
corvus_192's user avatar
5 votes

Rock, paper, and scissors C++

using namespace std; This is quite harmful (particularly as you graduate to working on larger programs). It throws away useful information as to which ...
Toby Speight's user avatar
  • 76.8k
5 votes

Rock, paper, and scissors C++

Verify user inputs Rule #1 in application development: Never trust user input! For example: ...
Green绿色's user avatar
5 votes

Minimal AlphaGo algorithm implementation for game 2048, connect4

The code layout is good, and you used meaningful names for classes, functions and variables. Assuming this code is to be used as a starting point for the students, I recommend adding comments at the ...
toolic's user avatar
  • 3,626
5 votes
Accepted

Minimal AlphaGo algorithm implementation for game 2048, connect4

You aim to teach folks to write good code. A noble goal! deps Before a student can run or enhance this codebase, they first need to get over some installation hurdles. This is a common hangup for ...
J_H's user avatar
  • 28.9k
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
  • 28.9k
5 votes
Accepted

BlackJack in python

This submission is about performance, but it does not include any profiling measurements. language choice If you're looking for raw speed, interpreted python usually wouldn't be the first choice. ...
J_H's user avatar
  • 28.9k
5 votes

Basic python rock papers scissors game (first code)

Traditionally it's Rock, Paper, Scissors instead of Rock, Paper, Scissor. You've attempted to validate whether the user input an integer, but what you've written doesn't work. You immediately attempt ...
Reinderien's user avatar
  • 62.4k
5 votes
Accepted

Tic Tac Toe Basic C implementation

getchar() returns an int, not a char: Defined in header ...
Harith's user avatar
  • 8,437
5 votes

DIY Sudoku Solver (Windows Console App)

Suggestions to decorate the code with modern C enhancements such as restrict, etc. are also welcome How about some C23 ...
user555045's user avatar
  • 9,959
4 votes
Accepted

DOS-based Boggle simulator

Nice first real C program, and nice self-answer. I’ll add a handful of things Array Indices are size_t (or Maybe ptrdiff_t), ...
Davislor's user avatar
  • 7,946

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