New answers tagged beginner
1
vote
Gomoku game 5 in a row. Javascript simple game Canvas
Made changes according to tdy's advice and Wimanicesir's advice.
Fixed errors.
The code works as expected. Equality of elements is determined horizontally, vertically and diagonally. Edited the code ...
2
votes
Bash script to automate post install process on Fedora
Consider putting your functional blocks in functions instead of just indenting them and then just calling each of those if the previous function succeeds, e.g.:
...
1
vote
Creating Layout of 2D Board game
Three major improvements are:
try to avoid using continue as much as possible. It is rarely needed, and obfuscates the logic. It is not needed at all in your case.
...
1
vote
Creating Layout of 2D Board game
Bug
uint8_t board[100]; ... for (uint8_t i = 1; i < 101; i++) { board[i] = i; } attempts to access board[100] which is out ...
Community wiki
4
votes
Creating Layout of 2D Board game
Arrays are indexed starting from 0 in C, which means that valid indices for buffer are 0..<...
3
votes
Creating Layout of 2D Board game
As @toolic said, You can use "%3d" to print the number on a 3 width field, aligning every one.
In addition
You can completely remove the ...
5
votes
Accepted
Creating Layout of 2D Board game
Simplify
In the "even" clause, you can simplify the check:
if (((k % 10) == 0) && (k != 0)) {
as:
...
0
votes
Gomoku game 5 in a row. Javascript simple game Canvas
On the advice of TDI.
I removed function isEqual(a1, a2, a3, a4, a5) from my code.
Added function isEqual(arr).
Set the condition using the slice() method.
...
1
vote
Gomoku game 5 in a row. Javascript simple game Canvas
The accepted review has a few useful tips but is a little bit short IMO.
General
You used functional programming to tackle this problem. Which is doable but creates a mess real quick! Consider to ...
4
votes
Accepted
6
votes
Coding exercise to represent an integer as words using python
First, the spec itself is not very good. Conventionally, English numerals are never written out in Title Case so it doesn't make sense to code for that. Also, the spec is missing the hyphen and ...
4
votes
Accepted
Coding exercise to represent an integer as words using python
In addition to the good suggestions in the previous answer, here are some more things to consider.
Bug
When I run your code and give the "Example 3" input (...
5
votes
2
votes
Accepted
Printing a pattern of input string in X shape
Writing index-conditional statements on the inside of a loop is a code smell. Instead you should prefer "looping like a native" making appropriate use of ...
3
votes
userform with textboxes and dates to show timeline
We can use Me.Controls to reference the Controls by name. Although, it looks cleaner there will be no noticeable change in performance.
...
4
votes
Printing a pattern of input string in X shape
A big change would be to improve the readability of the program.
Some changes I would make are:
Add spacing between operators and make bracket style consistent (e.g. ...
5
votes
Simple casino game
Some things not mentioned in other answers:
What's the problem with "using namespace std;"?
std::endl does more than just newline, so don't use it unless ...
4
votes
Simple casino game
In general, I would avoid using global variables. Variables such as pHand should be defined in blackJack and then passed by ...
7
votes
Simple casino game
Here are a few suggestions:
Give more instructions for user input and validate it carefully. I tried out the program, entered "1.", and immediately got stuck in an infinite loop.
It is much ...
3
votes
Guess-the-number game in Python
The bulk of your code deals with validating the input. My suggestion is to factor them out to separate functions, making the code cleaner. Also, it helps to write down what kind of input is acceptable,...
1
vote
adding data to a CSV file for it to be read
Let me address the most obvious issue: not using the csv standard Python library. You should use it because:
It handles the CSV data
It makes code easier to read
...
3
votes
Bash manual page selection menu (version 2)
I guess the reset command to clear terminal and scrollback buffer isn't available on your target? In any case, that's an irritating thing for a program to do.
...
3
votes
A simplified Blackjack C++ OOP console game
getch returns 0 (not '0'!) only in special circumstances. But normally it's supposed to ...
5
votes
Accepted
A simplified Blackjack C++ OOP console game
Miscellaneous observations
I already have a long answer examining blackjack.h; these are the unrelated issues I've spotted, in no particular order.
...
4
votes
A simplified Blackjack C++ OOP console game
There are some problems with blackjack.h that I'd like to address.
What jumps out immediately is the large number of header files it includes. Particularly ...
8
votes
A simplified Blackjack C++ OOP console game
General Observations
There are a few good practices here, the include guards are implemented properly. Overall the code should be reworked following best practices ...
2
votes
Accepted
Parsing Lists: BIO 2024 Q2
This is clear, well-presented code; much better than the thrown-together hacks often seen as programming-challenge entries.
We could perhaps make it even clearer by giving a name to ...
4
votes
C - mini string lib
Lots of good reviews already done.
I'll add some points only about concat() - many of these points apply to the overall code.
Concatenation detail
Make clear this ...
1
vote
Number Guesser Game in plain C
Do not use scanf() for user input:
Checking the return value alone does not suffice. If the converted input is larger than the maximum value of an ...
9
votes
7
votes
Accepted
C - mini string lib
Overview:
You don't keep the String consistent when you free the string. You set the buffer to NULL but the length is not reset. So if you now use this with any ...
3
votes
Plain JavaScript Rock, Paper, Scissors
There are a ton of RPS implementations in JS and even on the code review site. So I will mainly focus on your specific style.
First let's address your questions:
Are the variables named well?
The 3 ...
2
votes
Number Guesser Game in plain C
In addition to the good points in
the other answer,
here are some other things to consider.
Displayed messages
The messages you display to the user make it clear how to play the game
and make it easy ...
5
votes
Accepted
Number Guesser Game in plain C
Good re-learning effort.
Bug (kinda)
printf("Guess the number (0-%d): ", range); implies that 0 to range is a ...
Top 50 recent answers are included
Related Tags
beginner × 7556python × 1991
java × 1033
c++ × 899
python-3.x × 823
javascript × 685
performance × 623
c# × 565
c × 564
object-oriented × 476
programming-challenge × 430
game × 430
strings × 326
algorithm × 305
php × 237
calculator × 214
rust × 207
tic-tac-toe × 201
haskell × 198
html × 195
console × 184
array × 180
jquery × 175
ruby × 161
python-2.x × 148