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

TicTacToe in Haskell

Are there any ways which I could improve and simplify this code? Is my code idiomatic Haskell? Is the use of a lens library to change an element of a two-dimensional array unnecessary? If so, how ...
4
votes
3answers
532 views

TicTacToe game with functional AI in ruby - follow-up

A month ago I posted an earlier version of the game here, and got a great response, which was mainly about the structure of my code. I freed some time today and reworked the code from scratch. Things ...
6
votes
3answers
71k views

Python Tic Tac Toe Game

I made this as a personal challenge. It seems to work fine as I can't find any bugs and am happy with how it runs, but I am interested in what I should do to make the code more professional. I think ...
7
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. ...
6
votes
1answer
5k views

Tic Tac Toe in MVC

Do I have basics of MVC and SOLID principles right in this simple 'Tic Tac Toe' game? View.java ...
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 ...
6
votes
3answers
3k views

Java Tic-Tac-Toe game (implemented through MVC)

After seeing Tic Tac Toe in MVC, I attempted to create something similar. My program uses the Swing library and it's relatively simple. When I run the game, it's just a 3x3 grid with no extra features....
11
votes
1answer
479 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 (...
8
votes
2answers
431 views

Tic Tac Toe game in Haskell

...
4
votes
1answer
191 views

Tic Tac Toe game in haskell follow up

This is a follow-up question of this one: Tic Tac Toe game in Haskell I have revised my code. How does it look now? ...
3
votes
2answers
709 views

Tic-Tac-Toe in C++11 - follow-up 2

Previous question: Tic-Tac-Toe in C++11 - follow-up Is there any way to improve this code? ...
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 ...
12
votes
3answers
35k 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, ...
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 ...
5
votes
1answer
8k views

Simple Tic-Tac-Toe with Minimax Algorithm

I have implemented AI to tictactoe game by using Minimax Algorithm. The game looks working okay and AI is intersecting the player moves to block him from winning the game. I would like to know if I ...
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 ...
14
votes
1answer
167 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 ...
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 ...
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 ...
3
votes
1answer
282 views

Tic Tac Toe implemented in WinForms using Model-Viewer-Presenter Pattern

I had to build a 2-player Tic Tac Toe app in C# w/ WinForms for a pre-interview screen. I got past that stage successfully and the app works flawlessly, but I would like to get some feedback. ...
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 ...
6
votes
2answers
4k views

Checking winning conditions in Tic-Tac-Toe

This code checks winning conditions in Tic-Tac-Toe by checking if there is any row, column or diagonal with the same symbols. The board is a 2-dimensional array of ...
6
votes
3answers
7k views

Tic Tac Toe in C++

Here is my two-player Tic Tac Toe game. How can I improve it? ...
4
votes
2answers
132 views

Callback-oriented Tic-Tac-Toe

I have written a simple implementation of the game Tic-Tac-Toe designed to allow "pluggable" player control, meaning I can easily swap out the controlling logic for players without modifying the game ...
11
votes
2answers
215 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 ...
8
votes
5answers
2k views

Tic-Tac-Toe in C++11

I have found Tic-Tac-Toe source code: Tic Tac Toe in C++ I have rewritten the source code in C++11 as shown below. How can I minimize hardcoding in the game logic? ...
8
votes
4answers
768 views

Noughts and Crosses in Python using the pygame module

I've created a Noughts and Crosses game in Python using pygame, and I'm quite pleased with the result that I've produced. I've managed to reduce the code to what it is now, as it used to be much ...
7
votes
1answer
2k views

Tic Tac Toe in Python (Jupyter)

I am working on Jupyter Notebook and I am new to Python. I have created this tic tac toe game. ...
7
votes
1answer
473 views

An unbeatable Tic-Tac-Toe game using exhaustive enumeration of all cases

I am a beginner programmer and I've been trying to complete an unbeatable tic-tac-toe program, my code is below. The program itself works, but it seems rather inefficient, as I literally have to type ...
6
votes
1answer
342 views

An unbeatable TicTacToe game

I wrote an answer to another question about the same subject and a new implementation, but instead of just posting my code there I think it's a good chance to see what can be improved on my own code. ...
5
votes
3answers
827 views

Tic-Tac-Toe program

My code can play the tic-tac-toe game with two human players. How can I can make it better ? I will be making a new version that plays tic-tac-toe against a computer later. ...
5
votes
2answers
190 views

Tic Tac Toe in C++11

I wrote this to sort of gauge my understanding of the bare basics of C++.Could you guys give me any pointers? (Ha, get it?). I would happy to hear what you have to say about the code. Also is it neat (...
4
votes
1answer
2k views

Tic-Tac-Toe class written in Python

How well is this Tic Tac Toe code written? Where may I improve it? This is meant to be a platform for a machine learning algorithm. The code is written so any player may play first. Once a player ...
3
votes
1answer
394 views

Java MVC TicTacToe - follow-up

Here is my previous question: Java Tic-Tac-Toe game (implemented through MVC) I'm reposting again because I made a lot of changes to the code. I wasn't able to implement everything as I don't know ...
3
votes
0answers
446 views

React Tic Tac Toe

This is a project that grew out of the React Tutorial and is one of my first efforts at solving React problems on my own. There is a lot of code here and I am sure that there are more concise ways ...
2
votes
1answer
3k views

Python Tic-Tac-Toe game

I have it running well and would just like any suggestions. Note: Yes I am using global variables and would like to keep it that way, at least for now. The reason is, that I am using The Great ...
2
votes
3answers
3k views

Tic Tac Toe game with emphasis on design and readability

I have written a Tic Tac Toe application with the focus of clear design and easy to read code. The current algorithms are very crude. I also want to separate them using interfaces. Any tips on ...
1
vote
1answer
464 views

C# Events in a Tic Tac Toe game

I am new to coding and am trying to understand events what is an annoying stage but super important I guess. I just made a Tic Tac Toe game and it is working but not really "beautiful" coded. I really ...
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 ...
12
votes
1answer
714 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 ...
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
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
174 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
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
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-...
6
votes
2answers
2k views

TicTacToe GUI needs optimizing

I've been working on a TicTacToe GUI. While the game works with a proper restart, exit and win conditions; I feel that it could still be better optimized. I'm not particularly concerned with the ...
6
votes
2answers
5k views

Tic-Tac-Toe game in C#

I've been learning C#, and today I made a simple Tic Tac Toe game. The code is pretty long, and I'm almost 100% positive that this can be done so much better. Please provide some advice, suggestions, ...
5
votes
4answers
836 views

Tic-Tac-Toe in C++11 - follow-up

This is based on my first Tic-Tac-Toe game: Tic-Tac-Toe in C++11 I have come up with different game logic for my game. I would like to know which one is more reliable and effective and how I can ...
5
votes
1answer
2k views

Tic Tac Toe in PyGame

This is my first python/pygame program. Instead of using images I tried drawing with pygame.draw.line() and pygame.draw.arc() ...