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
8
votes
1answer
19k views

Tic-Tac-Toe & counter against the player's moves and count scores

Here's a Tic Tac Toe program I wrote in C++. It can play (semi-effectively) against the player. Please give tips on how to improve. ...
7
votes
2answers
3k views

Noughts and Crosses WPF app

I've been learning C# and was looking for some feedback on my latest project, which is a standard Noughts and Crosses game. Two people are required to play (no AI yet). MainWindow.xaml.cs ...
4
votes
2answers
11k views

Tic-Tac-Toe game using the minimax algorithm

I have written a Tic-Tac-Toe game in Python that contains, among others, a player that uses the minimax algorithm. I am not exactly a beginner at Python, but I'm not very experienced with it - so I ...
3
votes
2answers
249 views

Clojure Tic Tac Toe solver

I am going through the 4clojure problems and I currently just solved the Tic Tac Toe analyzer: ...
5
votes
1answer
245 views

Lightweight Tic-Tac-Toe in Python

This is a completely functional python script of the Tic-Tac-Toe game. I've used python's set container for almost all data structure and operation. The code is ...
8
votes
1answer
4k views

HTML5 Tic-Tac-Toe game

I created an HTML5/JS tic-tac-toe game as an exercise and wanted some advice on my js code. A couple of questions: How can I improve the reset method? (currently reloads the page/re-initializes ...
5
votes
2answers
4k views

Tic Tac Toe with classes

I have created Tic Tac Toe in c++ using classes. Is this efficient code? And GNU GCC compiler gives these warnings: ...
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 ...
4
votes
3answers
10k views

Tic-Tac-Toe Game

I want recommendations on how to improve this code. JSFiddle for you to play in (It's laggy, so it would be better if you download the images and try it in your own PC). ...
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 ...
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 ...
0
votes
1answer
51 views

Cleaning up a class that contains the object it represents [closed]

I've recently started writing a tic-tac-toe game (following the Odin project) and am trying to write a class to hold the board game. What I'm not sure about, is that the board class holds all the ...
5
votes
3answers
1k views

Making this Tic Tac Toe implementation more recursive

Here is a Tic Tac Toe game in C++ that I have been working on. My questions are as follows: I tested it for bugs, but if you find any, please post the solution! I want to make the code more recursive,...
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 ...
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 ...
7
votes
2answers
503 views

Optimizing this inefficient TicTacToe configuration parser

On a programming contest I came upon this question: Given a partially played 3 × 3 tic-tac-toe configuration, write a program to determine which player will have a better chance of winning if the ...
7
votes
1answer
2k views

Tic Tac Toe (2 players)

So here we have a little game of Tic Tac Toe I've made. It runs well on TI-83/84 calculators and it doesn't seem to have any problems. However, I'd like to eliminate some of the code that seems bulky ...
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 ...
7
votes
2answers
1k views

Checking for a win in TicTacToe

It looks like it should be shortened but I can't see how. I have my methods <= 5 lines but that's as far as I got: ...
6
votes
3answers
7k views

Tic Tac Toe in C++

Here is my two-player Tic Tac Toe game. How can I improve it? ...
10
votes
3answers
727 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 ...
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 ...
2
votes
1answer
4k views

Turning 1D array to 2D array in TicTacToe

To check a win in my TicTacToe game, I have created a 2D array that contains all the combination that a game can be won in, like so: ...
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 ...
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 ...
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. ...
14
votes
4answers
713 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 ...
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: <...
8
votes
1answer
5k views

Clean code and SOLID principles for a simple Python TicTacToe game

I recently read the book Clean Code and I also did some research on the SOLID principles. I'm looking for general feedback on if I was able to transpose the examples (written in Java) to Python while ...
5
votes
1answer
105 views

Adding more responsibility to this endgame-analyzer class

I have written a Tic-Tac-Toe game. I have a class called GameEndAnalyzer that will check if the game has already ended or not. Would it violate the Single ...
6
votes
1answer
1k views

Player VS player Tic-Tac-Toe game

This program is supposed to be a player VS player Tic-Tac-Toe game. The computer then checks whether you've won, lost, or tied. The code does work, but I don't want it to work through hacking; I want ...
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 ...
1
vote
2answers
333 views

Android class in Tic-Tac-Toe

CellDrawableProvider is an Android class used in the game Tic-Tac-Toe. It provides drawables for cells of game board (drawables for figures X and O, and "Fire" if ...
7
votes
4answers
2k views

Tic-Tac-Toe design

Kindly look at this code and point out design flaws or areas for improvement. I think I've done the last part right (the enum). I think the rest of the design is flawed but I am very new to object-...
1
vote
2answers
138 views

Multiple independent or layered constructors for TicTacToe?

At first it was like this: ...
6
votes
2answers
1k views

Tic-Tac-Toe optimization

I've made a Tic-Tac-Toe program (non-AI) for 2 human players. I will implement AI for a computer player later on. I am a beginner programmer and am also new to classes, which I've implemented in this ...
2
votes
1answer
524 views

Extremely Object Oriented Tic-Tac-Toe in Java

Please criticize the classes GameJudgeImpl and GameInfo so that I could make them clearer. ...
1
vote
1answer
256 views

Ruby Tic-Tac-Toe using classes

This is Tic-Tac-Toe using negamax for AI. Help me make it better! Some sore points are: ...
3
votes
1answer
2k views

Graphical Tic-Tac-Toe game using SFML

First of all, I'm really new to SFML and making GUIs. This is my first real program using this. Right now, when I click outside the window when the program is first run, the first piece is placed in ...
2
votes
1answer
1k views

TicTacToe in Java

I created this game in Java: ...
3
votes
5answers
18k views

Tic Tac Toe victory check

I am writing Python code for a Tic Tac Toe game. I need to write a function that takes in three inputs: board, x, and y. Board being the current display of the board and then x and y being values of ...
4
votes
1answer
13k views

First JavaScript game: Tic Tac Toe

I'm pretty new to programming in general. I work with MySQL at my job but my knowledge of scripting language is rudimentary at best. I've been learning JavaScript via Codecademy but I got bored and ...
7
votes
1answer
732 views

Clojure TicTacToe (logic, no GUI)

I whipped this up last night and was wondering if anyone had any thoughts/comments on it; for example, on: Code organisation Coding style Other improvements Semantic errors ...
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 ...
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 ...