57
votes
Tic Tac Toe C++
Avoid platform specific code
If there is an alternative you should try to avoid platform specific code.
This entails avoiding #include <windows.h> and using ...
32
votes
Tic Tac Toe console program
This is not bad for a programmer as new to C++ as you have said you are. Keep up the good work! With that said, here are some ideas on how you might be able to improve your program.
Don't abuse <...
27
votes
Accepted
Tic Tac Toe vs PC
Here are some things that may help you improve your code.
Fix your formatting
The indentation, in particular, seems rather random. It may be that it's an artifact of posting the code, but it doesn'...
26
votes
Accepted
Tic Tac Toe in C++14
Here are some observations and suggestions that may help you improve your program.
Check your spelling
If you run a spell check on your comments, you'll find a number of things such as "peice" ...
25
votes
Accepted
First Program Tic-Tac-Toe
Here are some things that may help you improve your code.
Use the required #includes
The code uses std::string which means ...
24
votes
Accepted
4x4 tic tac toe
Your code is quite good for someone who started 10 days ago. Here are a couple of improvements you should consider:
Your code is hard to read due to inadequate indentation and spacing. Take a look at ...
19
votes
Accepted
Tic Tic Tic Tac Tac Tac Toe Toe Toe
You have many problems within your code, including:
Meaningless variable names (why, for example, is the user input named aaa?!);
Repetition;
Inconsistent ...
18
votes
Tic-Tac-Toe for the terminal
First of all: nice work! It's easy to read and understand.
Program organization
It's very good that you split the task to small functions.
Reading the body of main...
17
votes
Accepted
Tic Tac Toe game in C#
//Variable to store player, 0 is X, 1 is O.
int counter = 0;
Good thing that comment is there! This sets you up for some rather unimpressive player-turn logic ...
15
votes
Simple C# console Tic Tac Toe program
Bug
The same player can place its sign on a allready taken (by him) place. You have defended against this for the opponent although you use inappropriate language here.
You should just check if the ...
15
votes
Accepted
Simple Tic Tac Toe game inside terminal
On the whole this is nicely done for an application made during your first week of C programming. The functions are generally reasonably-sized, the code is comprehensible and the design decisions are ...
14
votes
Accepted
Tic-Tac-Toe code using c#
Choosing good identifiers
When I see a name like options I think of something a player can choose from like "single player" (i.e., play against the ...
13
votes
Check for a win on the board
What you've done here is listed all possible checks, but you've compiled it into a single method. Ideally, you should split this up into separate tasks, as there are three categories of similar checks:...
13
votes
Accepted
12
votes
Accepted
Python, JavaScript, PHP, HTML: Unbeatable Tic Tac Toe
As JosephtheDreamer has left the Python to someone else, I'll take up the challenge.
It's a small thing, but the styling for the definition of winning_combos doesn'...
12
votes
Accepted
Simple C# console Tic Tac Toe program
OK .. I took a look at your code. Let's do this one step at a time...
I'm using VisualStudio with Resharper Installed.
This causes a big chunk of your code to grey out.
The if clause
...
12
votes
Ncurses Tic Tac Toe with simplistic AI
Here are a number of things that may help you improve your program.
Eliminate global variables where practical
Having routines dependent on global variables makes it that much more difficult to ...
11
votes
Accepted
TicTacToe where the computer plays random moves against itself
Some of your functions can use list comprehensions.
As you seem to know maths, you may have come across 'set-builder notation',
and that's what list comprehension are based off:
\$S = \{2 \times x | ...
11
votes
Accepted
Tic Tac Toe - console application
First things first: your code is pretty easy to read, and very consistently formatted, good job on that.
You're including the right headers, and didn't go wild with using directives, and that's good ...
11
votes
Tic Tac Toe vs PC
Inconsistent Indentation
The code in Main is not indented.
The code in PC_turn is not properly indented.
The code in ...
11
votes
Simple C# console Tic Tac Toe program
First of all, why pos has 10 elements and everywhere you counting from 1 to 9? Let this array to have 9 elements and count from 0.
You must rewrite the ...
11
votes
4x4 tic tac toe
For coding since 10 days, this program is really impressive. If I had to learn something new and complicated as C++, I'd probably make many more mistakes.
One thing that is always tricky is input and ...
11
votes
Tic-Tac-Toe program
Don’t write using namespace std;.
Read through and bookmark the C++ Standard Guidelines.
Numbers I note later are citations from this.
...
11
votes
Accepted
I made Tic Tac Toe in C
Please check it if you can, and give your opinion!
Enable more warnings
...
11
votes
Accepted
A Simple Tic-Tac-Toe Game
Put all code in functions. This is what experienced programmers do, so you
would be wise to adopt the practice even if you don't fully appreciate all of
the reasons yet. After that change, you'll end ...
10
votes
Tic Tac Toe game in C#
Each of your buttonX_Click contains basically the same code. Don't copy-paste, instead create a method that contains this code and accepts the button as a parameter,...
10
votes
Tic Tac Toe game in C#
Other answers have noted that there is a great deal of unnecessary repetition in the button handling logic. There is also a great deal of repetition in the winning-condition-checking logic. Any time ...
10
votes
Accepted
Minimax implementation of tic tac toe
Sorry, but that someone is probably right. At the same time, thanks for being thus brave and asking on how to improve here.
It's not so simple to give feedback in such a scenario, since there are so ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
tic-tac-toe × 623python × 201
beginner × 194
game × 135
c++ × 110
java × 102
python-3.x × 84
object-oriented × 67
javascript × 63
ai × 62
c × 39
c# × 36
console × 33
performance × 22
algorithm × 21
c++11 × 19
ruby × 19
html × 18
python-2.x × 16
swing × 15
gui × 14
haskell × 13
array × 11
css × 11
jquery × 8