Questions tagged [tic-tac-toe]

A game, also known as "Naughts and Crosses", in which players take turns placing marks on a 3 × 3 grid in an attempt to form a line of three consecutive marks. You can also use this tag for variants of the game.

Filter by
Sorted by
Tagged with
38
votes
4answers
6k views

Ultimate Tic-Tac-Toe in C

Here is my attempt at the UTTT code-challenge (in response to the the Weekend-Challenge Reboot). Here is what I would like critiqued: I tested the code a few times for bugs, but I may have missed ...
31
votes
2answers
5k views

Tic Tac Toe C++

I made this Tic Tac Toe game and I would like to know your opinion and what can be improved. I also want advice about making it check if someone wins. I'm 10th grader, so I still need to learn a lot. ...
23
votes
5answers
28k views

Non-AI Tic-Tac-Toe program

I'm fairly new to C++ and to game programming itself. Today I decided to build a multiplayer Tic Tac Toe program using only elemental C++ syntax/data structures. I also implemented a text interface ...
23
votes
8answers
10k views

Simple C# console Tic Tac Toe program

I've been teaching myself how to program for a little bit now, and was hoping to get some critique on my most recent project, creating a Tic Tac Toe program! I'm hoping for people to point out some of ...
22
votes
6answers
4k views

Tic-Tac-Toe program in about 250 lines

I'm new to C programming and I recently challenged myself to writing a Tic-Tac-Toe program. I found that my code becomes lengthy very quickly with so many if ...
22
votes
5answers
12k views

Tic Tac Toe computer AI

I am creating a TicTacToe game for my college project, and when I finished the code for computer AI, I ended up with a big chunk of code. It allows the computer to make the winning move, stopping the ...
22
votes
1answer
5k views

Ultimate Tic-Tac-Toe with AI and GUI

During my hiatus, I decided to revisit some of the Tic-Tac-Toe questions here. I created a simple Tic-Tac-Toe GUI game, and then thought, might as well do the Ultimate Tic-Tac-Toe challenge. I am ...
20
votes
5answers
3k views

First Program Tic-Tac-Toe

This is the first little project I've made that didn't feel it was complete gibberish. But I couldn't tell. The biggest problem I had with this was using the ...
19
votes
3answers
2k views

Tic Tac Toe - console application

I have made a little Tic Tac Toe console application using OOP techniques and would love to get some advice and guidance on what I have done. I have tried to structure the program to be as organized ...
19
votes
2answers
42k views

Tic Tac Toe in plain JavaScript

I have created Tic Tac Toe game using plain JavaScript. Can any javascript expert review it and let me know whether the way I have written JavaScript code that is right (preferable)? I am unsure that ...
18
votes
2answers
3k views

4x4 tic tac toe

I just started coding 10 days back. This is my first program using classes in C++. It is a two player 4x4 tic tac toe game. It works perfectly. If there are any improvements I can make, please let me ...
17
votes
7answers
5k views

Tic-Tac-Toe for the terminal

I recently started learning C, and this is my first fairly large (to me) program. It's a basic Tic Tac Toe game for the console. There's no AI, it's just a 2-player game. Is there anything I can ...
16
votes
2answers
2k views

Recursive and flexible approach to Tic-Tac-Toe

Description This is my code for the Weekend Challenge Reboot - Tic Tac Toe Ultimate. The game can be played here: http://www.zomis.net/ttt (along with some other variations that are also use the ...
15
votes
5answers
18k views

Tic Tac Toe game in Java OOP

I have written a simple GUI Tic Tac Toe Application and since this is my first shot, I think it can be improved a lot. Please tell me what you think about it and what you see I made wrong so I can ...
15
votes
1answer
903 views

Tic-tac-toe in SQL with optimal AI

The simplest introduction to this code is to play it! Here's an SQL Fiddle. However, to enjoy it fully, you'll need a more interactive environment, like the psql ...
14
votes
5answers
6k views

Tic Tac Toe in the Console

I have made a Tic Tac Toe game in C#. How can I improve my code? The full listing is as follows: ...
14
votes
4answers
9k views

Basic Tic-Tac-Toe

I am starting a software engineering degree soon and have been practicing the last couple months. I have posted some code I wrote for a basic Tic Tac Toe game below (C++). I have read the worst thing ...
14
votes
3answers
1k views

Ncurses Tic Tac Toe with simplistic AI

I have read your rules and in particular the part about bite-sized portions, so I am apprehensive about posting this but want to do it anyway. I have recently begun getting into C and in particular ...
14
votes
4answers
714 views

Tic-Tactics implementation

I've tried to take the shortest, simplest path to a C# solution to the Ultimate Tic-Tac-Toe challenge. This implementation plays in the console. I admit the game logic could be hived off into a ...
14
votes
2answers
8k views

Unbeatable Tic-Tac-Toe program seems difficult to read

I've made an unbeatable Tic-Tac-Toe in Python 3.3. While it truly was unbeatable, it was an eyesore to look at and nigh impossible to read. That code is here. I have since then optimized it for ...
14
votes
2answers
190 views

Ultimatoe — 2. The model

The game model (Ultimatoe) consists of 9 instances of Tic-Tac-Toe (UltimatoeBoard) and some auxiliary information. As the number ...
14
votes
1answer
4k views

Tic Tac Toe game that uses Minimax algorithm to pick the best move

I written a Tic Tac Toe game, which allows you to play against another person or the AI (The AI can also play against itself, which should always result in a tie). The AI uses the Minimax algorithm ...
14
votes
1answer
1k views

Three in a row: Tic, Tac, Toe

The other day, I started thinking of a new personal project to start that I wanted to do in Java. As I started to do it, I realized that I was constantly deleting classes, creating new ones, merging ...
14
votes
1answer
173 views

TicTacToe with AI in ruby - follow-up overload

I already posted this program numerous times, always surprised by the amount of improvement that is possible suggested by people here. Is it possible to make it even better, without nitpicking? At ...
13
votes
1answer
2k views

3D Tic Tac Toe/Connect Four game with AI

I came up with this during English lessons many years ago to kill some time, and just decided to try code it. It's basically a 3D version of Connect Four/Noughts and Crosses/Tic Tac Toe, but the grid ...
13
votes
2answers
4k views

Tic Tac Toe in Python

I wrote a mediocre Tic Tac Toe game. Take a look. ...
12
votes
3answers
36k views

Tic Tac Toe game in C#

I wanted to get into C#, so I tried making a simple game. My first language was Java, so it was pretty easy to get the hang of C#. I know that there are multiple other posts of Tic Tac Toe games, ...
12
votes
1answer
12k views

Simple Tic-Tac-Toe PHP/Pure HTML

I've been doing a simple Tic-Tac-Toe with PHP, generating only HTML code. A few notes: I didn't bother yet to give an AI to the opponents (the Os), and it is intentional. There is no CSS style to ...
12
votes
1answer
720 views

m,n,k-game (i.e. generalized tic-tac-toe)

I'm back after Tic-Tac-Toe in Haskell with a new version. I added Haddock documentation and wrote a generalized version known as the m,n,k-game. By doing so, I had to redefine ...
12
votes
2answers
2k views

Ultimate Tic Tac Toe A.K.A. Tic Tactics

My attempt at this challenge., incorporating lessons from this question, which turned out into a much bigger project than I anticipated, but it works. I'll definitely be refactoring most of this in ...
11
votes
2answers
3k views

Tic Tac Toe vs PC

Please help me reduce its complexity and maybe optimize it a little bit more. ...
11
votes
4answers
5k views

Tic Tac Toe game

I don't have any questions about this piece of code; it compiles just fine in Visual Studio 2010. I just wanted to post it to see if anyone has any good ideas on how to simplify it, or pointing out ...
11
votes
3answers
17k views

4×4 Tic-Tac-Toe in C

While trying to teach myself C, I decided to take a stab at writing this Tic-Tac-Toe program on a 4x4 board. It will be great if somebody could review it and let me know of some ways of refining this. ...
11
votes
2answers
217 views

Tic Tac T-OO: Design and Implementation

I want to learn OO design and as a start, I implemented Tic Tac Toe. I'd like to hear your thoughts on the design and implementation. Classes: Player - Has just a ...
11
votes
1answer
480 views

Ultimatoe — 1. GUI and general game interfaces

For the community challenge, I wrote ultimatoe. For me, the most interesting part is clearly the AI, but what I did so far is just a stupid Monte Carlo tree search, which isn't ready for a review yet (...
11
votes
1answer
2k views

Real time Tic Tac Toe game in Javascript using Socket.IO

This is my first attempt at building a full project. I've recently learned using prototypical inheritance in JS. Please tell me how I can improve the quality of this code. The game is available here:...
11
votes
1answer
520 views

A Tic-Tac-Toe game in MonoGame

I've started learning MonoGame and C# lately, so in order to get more confident with both and do something not completely trivial, I've built a Naughts and Crosses game. I am using 7.1 version of C# (...
11
votes
1answer
2k views

Simple Tic-Tac-Toe Application in WPF

I made a Tic-Tac-Toe game in WPF and was just hoping for some input as I am pretty new to WPF and I am still a student so I'm sure that my C# code in general may be lacking XAML: ...
11
votes
1answer
2k views

Yet another minimax tree for TicTacToe

I have written a working minimax tree for Tic-Tac-Toe. What I have done so far is create a tree with end node having value 10, 0 or -10 base on win, lose or draw. After I create a tree I then ...
10
votes
4answers
2k views

TicTacToe AI needs optimization

How do I condense this gigantic monster into something more manageable? I heard about command pattern but I can't figure out how to use it. What other solutions are there? ...
10
votes
3answers
728 views

Conditionals validation for Tic Tac Toe

I have been working with Java for a little more than a year. I recently have built a Tic Tac Toe game as an assignment for my Java class. After my instructor graded it, he wrote a comment around my ...
10
votes
2answers
1k views

Tic Tac Toe - Stage 1: console PvP

I'm currently working on a Tic Tac Toe project to improve my programming skills, and I'm simultaneously learning Git. This is my GitHub page for my Tic Tac Toe project. I will post the code below so ...
10
votes
2answers
2k views

TicTacToe where the computer plays random moves against itself

I wrote a quick program in Python to play against itself in a game of (random) tic-tac-toe. It seems to work, but can you guys please look at it and let me know if I'm doing things the 'correct' (i.e....
10
votes
2answers
1k views

Tic Tac Towards FX

I'm planning on taking on this community challenge. However, before my tics get tactical, I'd appreciate some feedback on the simpler implementation. Screenshots: Factoring in all the logic/edge ...
10
votes
3answers
375 views

TicTactics GameBoard Logic

This is my take at the current code-challenge, Ultimate Tic-Tac-Toe. It all started with a CellValue and a BoardPosition: <...
10
votes
2answers
177 views

Tic-Tac-Toe console application (as foundation for Ultimate Tic-Tac-Toe)

For the purpose of becoming better at C++ programming, I wanted to program Ultimate Tic-Tac-Toe as a console application for Windows in C++. However, I thought it would be sensible to create the plain ...
10
votes
2answers
742 views

Game of Tic-Tac-Toe

Here is a game of tic-tac-toe I created to run in python 2.7. I am still learning and feel 400+ lines of code is a bit lengthy for such a small application. However, trying to get some feedback on how ...
10
votes
1answer
2k views

SQL Tic-Tac-Toe attempt

In an attempt to practice conditional statements in SQL I decided to design a tic-tac-toe game with MySQL. Let me know if you think any of the steps could be done better. Step 1: Create the game ...
10
votes
1answer
6k views

Simple two-player Tic-Tac-Toe

How can I improve this simple code to look better, concise and elegant? I've been learning Python for 2 weeks. I knew about basic Python stuff and some algorithms and data structure as well. I made a ...
10
votes
2answers
3k views

OO design for Tic Tac Toe program

I am practicing object oriented design and have taken Tic Tac Toe as an example. I have written first all the requirements and then started writing code. I would like to get it reviewed so that I can ...