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
4
votes
2answers
2k views

Console Ultimate Tic Tac Toe game

Last week I wrote a C++ program on Ultimate Tic Tac Toe. The issue was that the program was a bit lengthy (~230 lines) and it is needed to be around 150 lines. I absolutely am not asking you to go ...
6
votes
2answers
2k views

Tic Tac Toe in C++14

I've decided to learn C++, coming from Python, and this is my first program. I would love some feedback on it. It's split up into two header files and one .cpp file: Board.h ...
3
votes
1answer
532 views

Tic-Tac-Toe game with AI

I started learning Racket recently and decide to revisit the problem that introduced me to computer programming: making a Tic-Tac-Toe game with AI. Here's the code: ...
4
votes
3answers
2k views

Tic-Tac-Toe game simulator in Java

I've completed this Tic Tac Toe simulator in java and so far it's working. It's just supposed to generate a pre-played game and announce the winner. I'm required to use a 2D array and this is the way ...
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. ...
4
votes
1answer
933 views

2 Player TicTacToe Game

I am a beginner Java programmer and I have just finished creating a simple 2 player TicTacToe game and would appreciate some feedback/advice on how to make it better. ...
3
votes
1answer
357 views

Tic Tac Toe against Al

I'm working on a project that has an option to playing against Al, so I started to make it in a separate class and just extended the main class which has an object of a GUI class which draws the ...
4
votes
2answers
6k views

Create and print a tic-tac-toe board

Write a program by creating an array of 9 integers that represent the positions in the tic-tac-toe board. Once the array is created, assign values to the board and print the contents of the board ...
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 ...
2
votes
1answer
3k views

C++ Tic-Tac-Toe Game

I decided to make a simple tic-tac-toe game in C++ as a small project. All help and suggestions are greatly appreciated! main.cpp: ...
10
votes
2answers
736 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 ...
7
votes
3answers
360 views

Swinging Tic-Tac-Toe

This is just a simple PvP tic tac toe program, I'm learning and just looking for maybe some feedback on how to improve it? There are mainly two things I can see improvement for, the action listener ...
2
votes
0answers
512 views

Tic Tac Toe AI - library based on Minimax algorithm

I recently struggled with implementing AI in Tic Tac Toe game. For better understanding of minimax algorithm I've decided to separate AI's logic. When I finished I thought that some may find it useful,...
3
votes
1answer
525 views

Tic Tac Toe with Python and Kivy

Accomplishment: Tic Tac Toe game with Python & Kivy I have created a simple tic tac toe game with a random bot logic (really random after a user selects a mark). Next step would be to insert the ...
0
votes
2answers
798 views

Java Tic Tac Toe [closed]

This is the TicTacToe.java program that I've coded. How can I make this code more like a production type of code (except for Lack of Comments Part)? Requirements: Design the basic Tic Tac Toe game <...
5
votes
2answers
202 views

Tic-Tac-Toe code in C++

I wrote this as an exercise. I think that I have some repetitive code in the "winner" function but I don't know exactly how to reduce it. Any other general advice would be welcome too. ...
5
votes
1answer
297 views

Console-based TicTacToe game

Recently I have been wanting to get better with Python, in particular with Python 3.x features and Python OOP, so I wrote what I thought at first would be pretty simple, a TicTacToe game, which turned ...
2
votes
2answers
2k views

Checking for a win in Tic Tac Toe

I'm working on Tic Tac Toe and I want do it for any ROW x COL board with any WIN_SIZE (e.g. 4x4 board requires 3 to win). I've done the ...
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 ...
3
votes
1answer
260 views

Naughts and Crosses: Human vs Computer in Python

So I am very new to programming and I am trying to pick up Python as a first language. I have programmed a simple game of naughts and crosses, but it is very wordy and there must be a simpler/quicker ...
5
votes
2answers
575 views

Expandable Tic-Tac-Toe Console Game in Python

I've created a console based Tic-Tac-Toe game in python that has the ability to be expanded to a 9x9 playing field or more if you wanted to. By default it's 3x3. Github link: https://github.com/Weffe/...
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
1answer
315 views

Simple Random TicTacToe Generator

I just finished building a simple random Tic Tac Toe generator. The program will display 3 rows of a random numbers 0-1 and will print a message when 3 of the same numbers align. The program works ...
2
votes
1answer
301 views

Tic Tac Toe (decoupling patterns and component based design)

I'm learning Unity with C# programming and am trying to learn game design. I know the that the best way to learn games programming is to recreate some existing games, and this is my code to create Tic ...
3
votes
1answer
113 views

Use of scoped objects in a JavaScript Tic-tac-toe implementation

I have been using the w3 org's JavaScript Best Practices web page's examples for coding an object literal for a game. It is my understanding that I should use this to keep all my variables and arrays ...
4
votes
1answer
2k views

Tic Tac Toe game made using jQuery and JavaScript

I have created a simple Tic Tac Toe game using JavaScript and using jQuery. I have used bootstrap for the UI. I am just a beginner, so some feedback on the JavaScript element would be great. <...
2
votes
2answers
276 views

__str__ method for a tic-tac-toe board

I am making my first object-oriented program in python and I am having trouble with the __str__ part of Board() class. I want it ...
3
votes
2answers
3k views

TicTacToe Implemented with classes

I made some changes to my class structure and the way I determine a win. I was attempting to decide if it made sense to keep the player completely isolated to ...
5
votes
1answer
1k views

TicTacToe Implementation With Classes

This is my first program using a class that I personally designed. Please pay special attention to the design of the class and I would love pointers and advice on how to better improve logical design ...
1
vote
1answer
909 views

Winning logic for Tic Tac Toe and OO design

I'm a Java beginner and I've just started learning about GUI. However, I'm not sure about GUI coding conventions and whether I'm getting the object orientation part of it right. I feel like I'm ...
11
votes
2answers
3k views

Tic Tac Toe vs PC

Please help me reduce its complexity and maybe optimize it a little bit more. ...
4
votes
1answer
144 views

Tic Tac Toe algorithm using itertools

I'm looking for feedback on the readability of my code and opinions on the pick_best algorithm. I do this stuff for fun when I have time, and never get a chance to have anyone else look at it. ...
1
vote
1answer
94 views

Tic Tac Toe Algorithm revisited

I had previously submitted a tic tac toe code. I followed some of the changes suggested. This is my new code. ...
2
votes
1answer
534 views

Algorithm for Tic Tac Toe

Currently, I am using an algorithm that finds the best move based on the existing states of the board. Is there a better way to do it? Is there a data structure that I can use? I have also considered ...
1
vote
1answer
228 views

Checking for a win along the top row of a Tic Tac Toe board

This code works so far and it is a TicTacToe game (Personal Project of Mine). I'm kinda new to programming. My question is I really do not like how the Connected method is at all, because well it's ...
2
votes
2answers
166 views

Simple TicTacToe game in C++

I just started learning C++, and this is one of my projects. It's just a simple 2-player (No AI) TicTacToe game that runs from the console. The project was to familiarize myself with arrays, so review ...
4
votes
2answers
108 views

Tic Tac Toe personal project

This is a Tic Tac Toe game in Java in preparation for my seconds personal project (chess game). I'm having a little problem though and am thinking that my for loop ...
2
votes
2answers
156 views

Method to check if TicTacToe board has a winner

I have a class called TicTacToeBoard that has a [3][3] array of TicTacToeBoardCells. Doc neck if board has a winner, I check if ...
4
votes
1answer
374 views

Tic Tac Toe using WinForms

I have made a simple tic tac toe game and need help tweaking it to fit the bill of object oriented design. Any suggestions most welcome. I basically want it safer, and more "best practice-like" It is ...
1
vote
2answers
1k views

Simple Tic Tac Toe

I have written a simple Tic Tac Toe game in WPC C#. I am just a beginner and learning. Could you tell me if there is something wrong with my code / could be done better? I am pretty much satisfied ...
2
votes
0answers
290 views

Final Java TicTacToe MVC Program

After my previous post, I decided to work on the project myself for a while (two weeks) to see how far I could get after reading a few of the really helpful answers to my previous posts. I read up on ...
3
votes
2answers
123 views

beginner TICTACTOE game for my school projet

I just wanted to know how can I code more efficiently with my project. I'm pretty sure that all these nested "if's" can be done easier and with less code. I made a TicTacToe game with 3 difficulty ...
2
votes
1answer
3k views

Tic-Tac-Toe game in C++

I'm new to C++ and made this basic Tic-Tac-Toe game from scratch. I would like to know if there are simpler or more efficient ways of doing the things that are covered in the code. As I said, I'm new ...
1
vote
1answer
3k views

Tic Tac Toe (Player vs Computer)

I am looking on how I can improve my writing style and/or how to simplify how I write my code. ...
1
vote
1answer
894 views

TicTacToe Telnet server in Python

The code below works. The timings are as close as I can get to the system not packing out. Basically telnet to a server to play tic-tac-toe. Automated it. Bottom left is 1, middle left is 2, middle ...
4
votes
2answers
133 views

Tic Tac Toe C++ follow up

I have finally found some time to redo the last tic tac toe game I posted. I have gotten rid of "Magic Numbers" as well as any typos(if their are any please point them out but I think i rid myself of ...
4
votes
1answer
3k views

Tic Tac Toe game AI in C++

I wrote a Tic Tac Toe game from scratch a couple days ago. My AI doesn't always make the best moves, so I'd like some advice on how to improve it. I also hardcoded a move in a very specific ...
2
votes
1answer
2k views

Human-vs-computer X and O's game

Anyone have any tips on how to divide my code up into classes? This seems to work from me but would prefer to have it divided up into one or two separate classes if possible. ...
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
1answer
2k views

Tic Tac Toe with 3 AI modes or Two-Player

This is my first stab at a game AI, and I've been working on multiple game mode difficulties, so I decided to start with a simple game. :) I'm most concerned about efficiency of the AI algorithms, and ...