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
2answers
469 views

Tic Tac Toe game in Haskell

...
8
votes
1answer
789 views

Tic Tac Toe implementation in Ruby

Here's my first shot at implementing Tic Tac Toe in Ruby. After watching Gary Bernhardt's Functional Core, Imperative Shell, I thought this would be a great exercise in trying out the ideology ...
5
votes
2answers
235 views

Player assignment in Tic-Tac-Toe

I am building my first OOP program, Tic Tac Toe. I want to conquer it in chunks, but the first part for me is the intialization of the program and the creation of the two players. I want to get some ...
5
votes
2answers
767 views

Plays a game of Tic Tac Toe

As part of the odin project I've written this bit of code that allows two users to play a game of Tic Tac Toe. I'm still a relative newbie to Ruby and to coding and am guessing that there are much ...
3
votes
1answer
551 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 ...
1
vote
3answers
450 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? ...
4
votes
2answers
245 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 ...
7
votes
2answers
160 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 ...
4
votes
1answer
834 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 ...
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
472 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
522 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 ...
3
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
818 views

First OOP TicTacToe game

This is my first program using classes. How could this be improved? ...
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 ...
5
votes
3answers
1k 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
519 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 ...
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 ...
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 ...
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 ...
5
votes
4answers
842 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 ...
3
votes
2answers
750 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? ...
2
votes
1answer
189 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 ...
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: ...
3
votes
2answers
862 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, ...
6
votes
1answer
297 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? ...
3
votes
1answer
190 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
882 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 ...
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
657 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 ...
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: ...
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
816 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 ...
3
votes
2answers
258 views

Clojure Tic Tac Toe solver

I am going through the 4clojure problems and I currently just solved the Tic Tac Toe analyzer: ...
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 ...
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 ...
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 ...
10
votes
3answers
741 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 ...
1
vote
2answers
138 views

Multiple independent or layered constructors for TicTacToe?

At first it was like this: ...
5
votes
1answer
247 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 ...
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 ...
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: ...
7
votes
1answer
3k 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 ...
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 ...
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. ...
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). ...