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
0answers
517 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,...
5
votes
1answer
303 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 ...
3
votes
1answer
545 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 ...
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. ...
2
votes
0answers
299 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 ...
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 ...
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
269 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
586 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 ...
3
votes
2answers
4k 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 ...
2
votes
1answer
333 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 ...
1
vote
1answer
256 views

Ruby Tic-Tac-Toe using classes

This is Tic-Tac-Toe using negamax for AI. Help me make it better! Some sore points are: ...
19
votes
2answers
43k 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 ...
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. <...
5
votes
1answer
167 views

Tic Tac Toe - Stage 2: console PvP + PvE + “EvE”

A while back I had opened this topic: Tic Tac Toe - Stage 1: console PvP I had to put that mini-project on hold due to exams, but I've started working on it again a couple of days ago. Now it's ...
2
votes
2answers
296 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 ...
2
votes
1answer
547 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 ...
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
937 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
145 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
2answers
167 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 ...
1
vote
1answer
232 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 ...
4
votes
2answers
109 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 ...
4
votes
1answer
12k views

Simple class-oriented Tic Tac Toe game in C++

This is the code for my Tic Tac Toe game. The player functions are coded in the class tictactoe and the rest of the functions, which include checking the board for ...
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. ...
4
votes
1answer
379 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 ...
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
4k 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
919 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 ...
5
votes
1answer
3k 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 ...
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 ...
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 ...
3
votes
1answer
404 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 ...
4
votes
1answer
52 views

Callback-oriented Tic-Tac-Toe (follow-up)

A followup to this question, thanks to @mdfst13 and @janos for the feedback. I have made some changes to my code, mainly the following: Replaced the next method ...
3
votes
2answers
8k views

Basic Python Tic-Tac-Toe Game

I have just decided to get into programming as a hobby (and possibly a job in the distant future). After learning the basics of Python, I made Tic-Tac-Toe to apply what I've learned. I would ...
3
votes
1answer
3k 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 ...
3
votes
1answer
333 views

TicTacToe game with large switch statements

This 5 classes: CBoard, CInput, CPlayer, Console, ...
4
votes
2answers
134 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 ...
2
votes
1answer
936 views

Noughts & Crosses

This is my first ever program in my first language, Python. I wanted to know how I could improve my writing style. ...
2
votes
2answers
669 views

Tic Tac Toe C++ MVC design

This is my new version of my Tic Tac Toe game written in C++. I tried to follow community advice by separating I/O from the game logic and view (MCV). The code works great, and I am looking to see if ...
5
votes
1answer
388 views

Text Based: Player vs Player Tic-Tac-Toe

Just looking for a review on my code, its currently only player vs player, but I'll be working on the AI soon enough. Functions edit_name, tutorial, and AI have been left out as I haven't started work ...
4
votes
2answers
606 views

Tic Tac Toe “Cats Game”/End Game

I have made my first game in Python. My program can determine when there is a winner, however I am unsure what to do if the board is full and there is NO winner (a cats game). ...
1
vote
1answer
5k views

TicTacToe Win Checking

I decided to finally write up a Tic-Tac-Toe implementation. Since I'm currently learning web development, I decided to write it in JavaScript. My main problem, and what I want reviewed here is my ...
31
votes
2answers
5k views

Tic Tac Toe C++

I made this Tic Tac Toe game and I would like to know your opinion and what can be improved. I also want advice about making it check if someone wins. I'm 10th grader, so I still need to learn a lot. ...