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
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: ...
0
votes
0answers
1k views

Tic Tac Toe game in Python 3.X using tkinter GUI version 2

I am completely new to programming and to python and as my first self-learning project I am creating a simple Tic-Tac-Toe game. I have already posted a version of my code here on stack: Tic Tac Toe ...
4
votes
2answers
512 views

Simple text-based tic-tac-toe

I am learning C++ and I need help to review my first code and see how I could improve it in any way. Any suggestions are welcome. It was tested and it is free of bug. The code is a game called ...
4
votes
1answer
91 views

A command-line unbeatable Tic-Tac-Toe written in C

I'm trying to learn programming and this Tic-Tac-Toe is one of my first projects. The user gets to start first as 'x' or second as 'o'. Please give me any criticism you find on the code and give ...
2
votes
4answers
395 views

Tic Tac Toe check for win/tie in Python

In the below GameOutcome class I'm checking for wins/ties in Tic Tac Toe. I'm pretty set on breaking the checks into 5 different functions because I'm specifically practicing making functions short ...
2
votes
1answer
128 views

TicTacToe endgame feedback in C#

I'm learning C# and currently having an assignment on Tic Tac Toe. I'd love to have some feedback on where I can improve. I've managed to create the end game functions but I feel it could be improved....
0
votes
1answer
33 views

Noughts and Crosses Version 3

The code's structure has been changed to make the program more readable. I've also commented and split up the program into blocks for better readability as well. The recursion in the player and ...
2
votes
0answers
174 views

Tic-Tac-Toe with React hooks

I have found similar posts which has some optimizations on Winning-checking logic: React Tic Tac Toe My primary focus for this post is about hook setters being ...
3
votes
1answer
52 views

Noughts and Crosses Version 2

Made the game much more user-friendly than previous version - has an example grid to demonstrate input, Xs and Os are now used. Game can now detect draw. Changed the algorithm to detect winner, it'...
1
vote
1answer
54 views

Noughts and Crosses

My first program using C. I would appreciate pointers on how to improve the code. I exit just before turns reach 9 and the grid is filled because it causes all sorts of bugs. The computer is random. <...
3
votes
1answer
123 views

Design of a Tic Tac Toe program in Python

Here is a program I wrote to reproduce the known win proportions for random Tic Tac Toe games (X always moving first). It takes about a minute to play the one million random games that will be played ...
3
votes
1answer
56 views

Reproducing the known results for random tic tac toe play using Python

I'm reading "Code Complete" by McConnel and I'm practicing using object oriented programming to "reduce complexity". (By that McConnel means, among other things, that it should be very easy to read ...
0
votes
1answer
126 views

JavaScript Tic-Tac-Toe

The first function makes 2 players ...
2
votes
1answer
845 views

Tic Tac Toe game in Python 3.X using tkinter UI

I am learning to program in Python and as my first project I decided to create a simple Tic Tac Toe game. The game is working properly now and I am wondering if there is anything I could do to improve ...
2
votes
0answers
84 views

Repetitive Tic-Tac-Toe AI game with Python 3

I have a text based Tic-Tac-Toe game with a simple AI element that will take winning moves and block losing moves. The one piece of criticism I received was that I was 'hard coding' too much. I can ...
2
votes
0answers
78 views

Object Oriented Tic Tac Toe Python

I've been learning to code in my spare time for a couple of years. I have covered object oriented stuff before and can usually understand other people's object oriented code. This is the first time I'...
7
votes
1answer
470 views

JavaScript Tic Tac Toe game challenge

I just completed the Tic Tac Toe challenge at freecodecamp. I am looking for input on how I could shorten the code. For the click events such as s1.onclick, I feel ...
2
votes
2answers
189 views

My first Python project Tic Tac Toe v2

Hey guys this is my second attempt at a Tic Tac Toe game using the advice given in my first post: My first Python project: Tic Tac Toe Again, just looking for advice on things I can improve. There is ...
3
votes
1answer
97 views

Beginner TicTacToe

I am trying to learn Python 3.6 with the help of a book. Until now I have learned the basics of functions, conditions and printing etc. No loops yet - so they need to come from recursion. To test ...
4
votes
3answers
370 views

My first Python project: Tic Tac Toe

I just finished coding a Tic Tac Toe game for my first Python project. Everything seems to be running correctly, but I wanted to get some advice on things I can improve. The main loop is pretty messy ...
6
votes
1answer
405 views

Tic Tac Toe Game in C++ using Classes

I made a Tic Tac Toe game using classes to show a better approach than the Tic Tac Toe game in Tic Tac Toe in C++11 which works not with classes. I already posted the code there as an improvement ...
5
votes
2answers
195 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 (...
7
votes
5answers
674 views

Tic Tac Toe in C w/ ncurses Revision

Someone in this thread said I could ask for a review of my revision: Ncurses Tic Tac Toe with simplistic AI I re-wrote it from scratch using the suggestions from the answers. In particular I did the ...
4
votes
1answer
132 views

Tic tac toe with unbeatable AI

I wrote this simple command line interface tic tac toe game with unbeatable AI with unittests. Looking for any suggestions how to improve it. Game: ...
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 ...
3
votes
2answers
404 views

Beginner's user vs. computer Tic Tac Toe

I made a simply user vs. computer game on Tic Tac Toe. I used Object Oriented Programming to increase my understanding of this programming paradigm. Can you criticize any design flaws I have in my ...
4
votes
1answer
79 views

Battle Noughts vs Crosses in Javascript

This simple game tries to solve the problem of a game that often end in a lock. It does so by providing the players with Xs and Os with superpowers. With great powers come possible disadvantages. For ...
5
votes
2answers
4k views

Tic Tac Toe in Swift

Any feedback encouraged. My checkForWinner function feels cumbersome to me. ...
3
votes
0answers
644 views

Python TicTacToe AlphaBeta Program

I am looking for a review of my perfect TicTacToe algorithm. It will be split up into 3 parts: The function The GameState Class The game (NOT well designed) I am mainly looking for tips and comments ...
4
votes
2answers
68 views

Simple Python 3 TicTacToe Game

Relatively new here so please let me know if I'm doing something wrong. I'm mostly wondering if there's any additional way I can make this code more efficient. Specifically the moveset and win ...
2
votes
0answers
250 views

Tic Tac Toe in Python 3

Learning to code with python this is what i came up with. But looking at the code i am sure there are ways to improve. I would really appreciate a constructive review and some guidelines. ...
5
votes
2answers
113 views

Tick-tack-toe (Jumping into C++)

The exercise is from Alex Allain's book "Jumping into C++". From Chapter 10 Practical Problem 4: Write a small tic-tac-toe program that allows two players to play tic-tac-toe competitively. ...
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 ...
2
votes
1answer
387 views

Tic Tac Toe / Noughts and Crosses - First Program

This is my first program. Its a two player noughts and crosses game. I would really appreciate any comments on how to improve my code or make it more efficient. Many Thanks. It is written in Python 3....
6
votes
2answers
1k views

Tic Tac Toe game in Python

Most of what I'm writing is pretty quick and dirty as I'm crashing through a lot of stuff to learn. My variable/function/class names are most likely not efficient and I still need to get a lot of the ...
1
vote
2answers
249 views

Tic Tac Toe Python

I wrote a simple tic tac toe game in python. (I wrote the game logic and implementation separately) (in this case, it's a command line interface, I may do a Tkinter version) Can you review the code ...
1
vote
1answer
109 views

First Python game of Tic-Tac-Toe

I'm just getting started with Python and was hoping for some feedback on a simple Tic-Tac-Toe game I wrote. Specifically, is there a simpler way to check the win conditions for the game, and to break ...
6
votes
2answers
366 views

Tic Tac Toe with images

This is my first 'real' project in C# , i looked up some tutorials on the Internet for Tic Tac Toe. But they were not how i wanted it to be, so i came up with some own ideas and wanted some tips on ...
1
vote
1answer
380 views

TicTacToe game in C#

I have been studying C#, and I am trying to model the Tic Tac Toe game. Is my program reasonable or is there anything I need to improve? ...
1
vote
1answer
216 views

Tic tac toe game using C++

I wrote this C++ code for Tic-tac-toe for an interview (The basic skeleton was pre-provided) and got rejected because the code was too complex and inefficient. I'm not an expert programmer so I'd like ...
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 ...
1
vote
1answer
255 views

mapping a tictactoe board in javascript

I'm creating a Tic Tac Toe solver algorithm. The idea is to iterate through each row, column and both diagonals and put them into a map in JavaScript. With that map I can run other logic to check for ...
3
votes
1answer
349 views

Evaluation function for minimax/alphabeta algorithm for Tic Tac Toe AI

I am trying to develop an optimal evaluation function to use in minimax/alpha-beta algorithm for developing tic-tac-toe AI. I am counting number of circles/crosses in a row/column/diagonal with ...
0
votes
1answer
131 views

10 minute Tic Tac Toe

After seeing Snake coded in 10 minutes, I decided to try a similar challenge, albeit easier. The following is Tic Tac Toe that I coded in 10 minutes. Given the short time frame, I'm sure there are ...
2
votes
1answer
528 views

MiniMax Algorithm

This is my C implementation of the Minimax Algorithm to play tic-tac-toe. I consider myself a C beginner so any feedback on style, best practices, or efficiency is more than welcome. ...
2
votes
0answers
540 views

Two-player Tic-tac-toe game in React.js

I followed React Official Tutorial and before implementing time travel, I wanted to add a "New Game" button, and a LockBoard method that graphically prevents further inputs. Since I'm new to React, ...
3
votes
0answers
76 views

Tic Tac Toe game (Game logic, no UI)

I've implemented a simple class for managing a Tic-Tac-Toe game's logic and state in Typescript. This code is intended to be used by a larger program; it doesn't implement any aspects of a UI. I've ...
1
vote
0answers
66 views

Basic TicTacToe Game Number 1MillionAnd1

I put together a basic Tic Tac Toe game and would appreciate some feedback/advice on how to make it better. Specifically, the GUI is kinda awful. I would love to build more tests into this to test ...
2
votes
1answer
214 views

Python tic-tac-toe game - procedural programming only

I made a tic-tac-toe game that is a player vs. player version (no AI). I have tried not to utilize objects because I haven't really gotten there yet. A previous version (see here) utilized global ...
1
vote
2answers
13k views

Tic Tac Toe in C

would appreciate if anyone could look through my tic tac toe code and what I possibly do to improve upon it. Initializing the Board ...