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

Check if a game of Tic-Tac-Toe has a winner

I've implemented a Tic Tac Toe game with a public method checkWin() to check if the game has a winner. This is my code. ...
1
vote
1answer
1k views

Tic-Tac-Toe in C++

I created a program on Code::Blocks that allows you to play Tic-Tac-Toe with 2 players on the same program: ...
0
votes
1answer
30 views

Keep classes anonymous in TicTacToe program

My console TicTacToe program This is my first large project attempt and I want to learn how to keep classes as anonymous as reasonable and as protected/secure as reasonable. The program works as ...
3
votes
3answers
2k views

Tic-Tac-Toe project in Python

Here's a Tic-Tac-Toe program I wrote in Python. How can I improve it (.eg. make it more readable)? ...
5
votes
2answers
1k views

First Tic Tac Toe game

I've been learning Objective C for a few days so to test my skills I went ahead and made a simple Tic Tac Toe game using the console. I already have some experience with languages such as C++, Java ...
4
votes
2answers
1k views

Python command-line Tic Tac Toe for two humans

I’d love some feedback on this human v. human, tic tac toe game I wrote in Python 2.7.10. I’d love to hear your thoughts on optimization and making the code simpler and more “pythonic”. Also, I’m ...
2
votes
1answer
807 views

Tic-Tac-Toe game in Python-3.x

I would really appreciate a general review of my Tic Tac Toe game in Python as I have spent a lot of time on it. Any improvements or suggestions? ...
8
votes
1answer
808 views

Pygame version of my 3D Tic Tac Toe/Connect 4

I posted a question a while back asking for some feedback on the code of a game I made (it was limited to typing the input and drawing the output in ASCII). Now I've got it linked up with pygamef. ...
3
votes
2answers
946 views

Basic TicTacToe game in java

I was assigned to create a simple Tic Tac Toe game in java for class, and here is what I got. I would like to know how the code could possibly be shortened without using really advanced topics since I ...
4
votes
2answers
1k views

Tic-Tac-Toe machine learning

I recently started getting into machine learning and I wanted to write a "beginner program" which would learn to play Tic Tac Toe. This code was inspired by a different program I saw, meaning some ...
4
votes
1answer
73 views

Tic-Tac-Toe in Python 2.x

This is a class called Board which handles the tracking and checking of the state of the game. self.board is a dict of ...
2
votes
1answer
100 views

TicTacToe game in Python

I'd just like to ask if there's anyway to make the functions play_Game() or is_move_valid() anymore efficient. For example, ...
6
votes
2answers
605 views

Command Prompt TicTacToe in C#

I wrote a basic command prompt Tic Tac Toe Game. I want to know what can be improved in terms of modeling and what mistakes I've made (if any). ...
5
votes
1answer
383 views

Tic Tac Toe - Console Application

I feel that I have done as much as my knowledge base allows me to on developing this tic tac toe program. I would love for anyone to critique it and tell me of any good/bad points. Includes two ...
10
votes
2answers
1k views

Tic Tac Toe - Stage 1: console PvP

I'm currently working on a Tic Tac Toe project to improve my programming skills, and I'm simultaneously learning Git. This is my GitHub page for my Tic Tac Toe project. I will post the code below so ...
-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 ...
6
votes
1answer
484 views

1 or 2 Player CLI Tic-Tac-Toe

I wrote a simple tic-tac-toe program in Haskell. It runs on the command line, has a one and two player mode, and implements a minimax algorithm when you play against it. I'm used to writing proper ...
6
votes
2answers
870 views

Brief TicTacToe C++ example

Recently, I ventured into the realm of C++ programming. I have extensive knowledge in C and C#, but very basic knowledge of C++. I decided to build a brief TicTacToe example to test my knowledge. It ...
1
vote
2answers
6k views
7
votes
1answer
733 views

Clojure TicTacToe (logic, no GUI)

I whipped this up last night and was wondering if anyone had any thoughts/comments on it; for example, on: Code organisation Coding style Other improvements Semantic errors ...
1
vote
1answer
359 views

Tic-Tac-Toe game with jQuery

I am a beginner at web development and I write code as a hobby. Would you please critique this code? I created a Tic-Tac-Toe game using HTML/CSS and jQuery. I did it for fun as a personal challenge....
3
votes
1answer
205 views

TicTacToe game in Java

I have made a simple Tic Tac Toe game but I think I have not followed a few conventions. I hope if you could help me improve it by suggesting some fixes. ...
19
votes
3answers
2k views

Tic Tac Toe - console application

I have made a little Tic Tac Toe console application using OOP techniques and would love to get some advice and guidance on what I have done. I have tried to structure the program to be as organized ...
14
votes
1answer
178 views

TicTacToe with AI in ruby - follow-up overload

I already posted this program numerous times, always surprised by the amount of improvement that is possible suggested by people here. Is it possible to make it even better, without nitpicking? At ...
14
votes
4answers
715 views

Tic-Tactics implementation

I've tried to take the shortest, simplest path to a C# solution to the Ultimate Tic-Tac-Toe challenge. This implementation plays in the console. I admit the game logic could be hived off into a ...
3
votes
1answer
63 views

TicTacToe game with AI in ruby - follow-up

A week ago I posted my TicTacToe game follow-up question. The suggestions were referring mainly to the lack of polymorphism. Here's the new code, hopefully there's not a lot (or at all) to improve by ...
11
votes
2answers
2k views

TicTacToe where the computer plays random moves against itself

I wrote a quick program in Python to play against itself in a game of (random) tic-tac-toe. It seems to work, but can you guys please look at it and let me know if I'm doing things the 'correct' (i.e....
5
votes
1answer
1k views

Tic-Tac-Toe AI Player

I made a simple tic-tac-toe AI app, where the AI, who is always O, wins or ties. I just wanted some input on it, and wanted to know if there was any ways to improve it (not the functionality of it, ...
5
votes
2answers
245 views

Simple TicTacToe game, played by two simple A.I. players

I made two player objects (p1 and p2): ...
3
votes
2answers
134 views

Text-based Tic Tac Toe with DRY and PEP-8

This is a basic Tic-Tac-Toe game with a minimal interface. The only concessions to ease of use are input validation (7 lines) and 1-indexed rows and columns (a few bytes). I've been trying to tighten ...
5
votes
0answers
241 views

Tic Tac Toe in Haskell

After reviewing many Tic-Tac-Toe implementations, I decided to write my own. Here it is: Logic.hs ...
3
votes
1answer
556 views

Ruby Command Line Tic-Tac-Toe

The following is my implementation of a command-line Tic-Tac-Toe game, written in Ruby. This was my first attempt at practicing object-oriented design principles. ...
2
votes
2answers
4k views

Simple Tic-Tac-Toe game

Could you please have a look at my programming style? Is it ok? Do I create any redundancies in code which I haven't noticed? ...
4
votes
3answers
540 views

TicTacToe game with functional AI in ruby - follow-up

A month ago I posted an earlier version of the game here, and got a great response, which was mainly about the structure of my code. I freed some time today and reworked the code from scratch. Things ...
2
votes
2answers
588 views

Simple Java Tic-Tac-Toe game

About 2 weeks ago I made a Java game of Tic-Tac-Toe. It turned out great and it worked but it needed lots of help before it became a decent program. Since then, I have worked out lots of the kinks and ...
6
votes
2answers
621 views

Printing a Tic-Tac-Toe board in Ruby

I have two implementations of a function that prints out a basic board for Tic-Tac-Toe. Which of these should I include and why? ...
8
votes
2answers
1k views

Tic Tic Tic Tac Tac Tac Toe Toe Toe

I created a Tic_Tac_Toe class to play the game Tic Tac Toe. Is there a better way of coding a game like this? I started learning python 5 days ago and my knowledge ...
5
votes
1answer
2k views

Tic-Tac-Toe Game (Java)

This program runs the game tic-tac-toe within the console. The players, X and O, take turns placing their character onto the 3x3 grid. When a player successfully makes 3 in a row, either vertically, ...
0
votes
4answers
266 views

Evaluating a tic-tac-toe board using a C-style for loop in Rust

I program in C, and it's my favourite language. I've recently found Rust. I like their ideas. Sometimes looks like a weird mixture of C++ and Haskell, but overall it looks nice. The ...
5
votes
3answers
1k views

Tic-Tac-Toe - iterative implementation of alpha beta tree search

Does anyone have tips to improve the speed, clarity and accuracy of this non-recursive alpha-beta algorithm? It's my first program written in C. ...
3
votes
2answers
406 views

Noughts and Crosses GUI game in Java - Part 1/2: AI

(See also Noughts and Crosses GUI game in Java - Part 2/2: GUI) I was working on a GUI game of Noughts and Crosses, and this is what I finally got: Unfortunately, the entire source code for the ...
7
votes
2answers
2k views

Simple Tic Tac Toe game in Java

I've been learning Java for 4 weeks now twice a week and I wanted to test myself to see what I could do. I'd love to see what you think and how I can make it better. ...
2
votes
0answers
1k views

General Tic Tac Toe with Alpha-beta pruning in Java

I like toy AI and what can be better than starting from Tic Tac Toe. Basically, this is a command line program that asks the user to input the height of the game field, the width of the game field, ...
2
votes
1answer
1k views

Tic Tac Toe Player written in Python

I am posting this as a follow up to the Tic Tac Toe class in Python question. I have made extensive changes and rearchitected the code. I now have a board class, a <...
5
votes
2answers
1k views

Simple TicTacToe game with AI in Ruby

What changes do you recommend from the perspective of structure, logic, etc? ...
5
votes
3answers
537 views

Tic-Tac-Toe classes according to SOLID principles

I have these classes for my Tic-Tac-Toe game project. I am very new to object oriented analysis and design. Can anyone help determine if SOLID principles are preserved in this code or if it is ...
14
votes
1answer
1k views

Three in a row: Tic, Tac, Toe

The other day, I started thinking of a new personal project to start that I wanted to do in Java. As I started to do it, I realized that I was constantly deleting classes, creating new ones, merging ...
8
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 ...
4
votes
1answer
2k views

Tic-Tac-Toe class written in Python

How well is this Tic Tac Toe code written? Where may I improve it? This is meant to be a platform for a machine learning algorithm. The code is written so any player may play first. Once a player ...
23
votes
5answers
28k views

Non-AI Tic-Tac-Toe program

I'm fairly new to C++ and to game programming itself. Today I decided to build a multiplayer Tic Tac Toe program using only elemental C++ syntax/data structures. I also implemented a text interface ...