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 <...
26
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
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 ...
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...
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
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
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
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 ...
10
votes
Tic Tac Toe console program
There's a typo in this line:
}else if(arr[1]+arr[4]+arr[7]==3*10||arr[1]+arr[7]+arr[7]==3*11){ //win condition outputs the winner player's name for all
I think ...
10
votes
Python: Tic Tac Toe Game
I'll point out some useful starting points for improving your code. I would additionally recommend looking at some other implementations, for some further inspiration regarding logic and code ...
10
votes
Object-oriented programming for tic-tac-toe (only 66 lines) in Python
Your Board class is handling too much at present. It's managing the following items:
The board itself
Whose move it is
Making moves for either player
Printing the ...
10
votes
Tic-Tac-Toe game in C++
Avoid using namespace std;
If you are coding professionally you probably should get out of the habit of using the ...
9
votes
Accepted
Simple Tic-Tac-Toe with Minimax Algorithm
Here are some things that may help you improve your code. First, yes, you implemented the minimax algorithm correctly, but there's an easy improvement you can make that I'll show later.
Avoid magic ...
9
votes
Tic-Tac-Toe for the terminal
There's two things I'd change to simplify your code:
Use a two dimensional array. Sure you can do the conversion from a 2d position to 1d easily, but the compiler can do and ...
9
votes
TicTacToe with AI in C
General Observations
I see a lot of good programming practices followed here already, keep up the good work.
Most of the functions are small and follow the Single Responsibility Principle.
Use Library ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
tic-tac-toe × 636python × 202
beginner × 202
game × 142
c++ × 110
java × 103
python-3.x × 84
object-oriented × 68
javascript × 64
ai × 62
c × 42
c# × 38
console × 37
performance × 24
algorithm × 22
html × 19
c++11 × 19
ruby × 19
python-2.x × 16
swing × 15
haskell × 14
gui × 14
css × 12
array × 11
jquery × 8