Questions tagged [tic-tac-toe]

A game, also known as "Noughts 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
5
votes
1answer
4k views

Embarking on a Tic Tac Toe journey with JavaFX

On my educational trek through the capabilities of JavaFX, I thought it would be a valuable challenge to create Tic Tac Toe. It took me far longer than expected to get this far, but despite likely ...
1
vote
3answers
457 views

Simplifying Tic Tac Toe game

I'm in a little bit of a pickle on my Tic Tac Toe program because I can't see how to simplify the code without breaking it. Do I need to make my code modular? ...
3
votes
1answer
556 views

Optimizing a Tic-Tac-Toe AI

I built a Tic-Tac-Toe game in Python. The board is made of ASCII characters and it is the user versus an AI. The user chooses a number (1-9) and if the corresponding spot is open then either an 'X' or ...
-3
votes
1answer
2k views

Multiplayer Tic Tac Toe with Socket.io [closed]

I am trying to learn Socket.io and develop a multiplayer tic tac toe game. Right now, I have developed a game that plays well when hosted locally, but I cannot seem to transmit game moves between the ...
4
votes
2answers
268 views

Tic Tac Toe Game Sequence Generator

I want my code to write to a .csv file a bunch of patterns for Tic Tac Toe games (30000). I want to have 9 columns numbered 1 through 9 and in each have the number of the space in the grid that was ...
6
votes
1answer
3k views

Minimax for Tic-Tac-Toe

I have written AI for Tic-Tac-Toe using Negamax in JavaScript. The Negamax object is translated from an implementation written in Python. The code runs on a Node.js server and the player interacts ...
7
votes
2answers
162 views

Ticker Tackor Soldier Spy

This is a Tic Tac Toe game with a "new game" button. I'm after a general review of the code with some tips on how to make it simpler and tidier. GitHub HoboChess.java ...
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? ...
4
votes
1answer
477 views

TicTacToe game needs optimizing

I'm new to programming and want to check if I'm using best coding practices in my program. ...
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 ...
2
votes
2answers
4k views

Tic Tac Toe getWinner() method logic for a grid of any size nxn

I have a college assignment in which I have to make a Tic Tac Toe game work. Some of the code has been provided by my instructor like method signatures etc. Now the rules for this particular project ...
5
votes
1answer
527 views

Lightweight TicTacToe in F#

This is more of a 'model' of TicTacToe, as you'll see it's not "gameified" in the sense that it will allow for inputs and outputs nor will it record any "active" state of the game but those things are ...
4
votes
2answers
2k views

Tic-Tac-Toe solver

As a programming exercise, I've attempted a Tic-Tac-Toe solver which takes a finished board and determines a winner. On top of checks for malformed input/ambiguous games (e.g. both players with ...
4
votes
1answer
831 views

First OOP TicTacToe game

This is my first program using classes. How could this be improved? ...
2
votes
2answers
282 views

TicTacToe in OOP

I'm trying to learn some OOP programming using Java, so I've created TicTacToe. Could you give me some advice on how I can improve this code? Player.java: ...
5
votes
3answers
2k views

Does this Tic-Tac-Toe game follow abstraction and encapsulation?

This below program will be further enhanced for TicTacToe game with Human and Computer as players. Currently this program is written for choosing best move for a ...
2
votes
2answers
524 views

Keeping GUI and logic loosely coupled in Tic Tac Toe game

Original post: Tic Tac Toe game with emphasis on design and readability I got great help, but I feel like I have to ask how I can keep the GUI and logic loosely coupled. Is there any best practice ...
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 ...
4
votes
5answers
5k views

Tic-Tac-Toe game in Python

I've decided to use some of my free time to create a simple game in Python. I chose Tic-Tac-Toe, but I decided not to make it too trivial. I made my game support any board size. I would greatly ...
3
votes
4answers
6k views

Tic Tac Toe in Ruby

This 2-player tic-tac-toe game is the first thing I've really written from scratch in Ruby, without the guidance of a tutorial. I'm interested in knowing what could be improved upon to make the code ...
6
votes
1answer
564 views

JavaScript/Angular TicTacToe Minimax AI

I am interested in getting some feedback on the code for my TicTacToe game, implemented with AngularJS, particularly with respect to the AI logic, which is printed below. (The full code base is ...
4
votes
1answer
891 views

Tic-Tac-Toe game using erlang gen_fsm

I would like to use erlang to create an online, web-based game. I thought it would make sense to start with something easy, so I chose tic-tac-toe (which seems like a popular choice here). I am ...
3
votes
2answers
956 views

Tic Tac Toe in C

I implemented a version of the popular Tic Tac Toe game. It currently only supports two-player mode, but I'm planning to add artificial intelligence for user vs computer mode (which I don't know how, ...
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: ...
1
vote
2answers
185 views

JavaScript Tic Tac Toe - functional but could be DRYer

I've been working on a simple Tic Tac Toe game in JavaScript. It runs the way it should, but the Board.checkWin function (check every possible winning combo) could ...
6
votes
1answer
6k 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 ...
13
votes
2answers
4k views

Tic Tac Toe in Python

I wrote a mediocre Tic Tac Toe game. Take a look. ...
6
votes
1answer
299 views

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

Previous question: Tic-Tac-Toe in C++11 - follow-up 4 How to improve this code further? ...
2
votes
1answer
190 views

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

Previous question: Tic-Tac-Toe in C++11 - follow-up 3 I've been told to use <random>. However, it seems a bit more complicated than it looks to generate ...
3
votes
1answer
192 views

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

Previous question: Tic-Tac-Toe in C++11 - follow-up 2 Here, AI is being implemented. ...
5
votes
3answers
952 views

Try/catch in a Tic-Tac-Toe game

I'm looking at my code and it doesn't look very efficient. I'm simply trying to catch exceptions or prevent them from being thrown in the first place. Can you please take a look and tell me if there ...
3
votes
2answers
800 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? ...
5
votes
4answers
850 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 ...
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? ...
4
votes
1answer
782 views

Making Tic-Tac-Toe winning check more efficient

My code works perfectly fine and I would just like to clean it up a little. From the research I've done, I cannot find anyone that used a multidimensional list to a game of TTT. I'm just looking for a ...
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 ...
3
votes
0answers
841 views

Novice implementation of TicTacToe in Haskell

I want to learn Haskell and figured the best way to do it is to write a simple TicTacToe implementation. However the result feels very inelegant and I think it might be the best playground for your ...
23
votes
1answer
6k 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 ...
9
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 ...
8
votes
1answer
20k 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
269 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
248 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
5k 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
45k 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
11k 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 ...

1
6 7 8
9
10