Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [tic-tac-toe]

Use this tag for challenges involving the game of tic-tac-toe (https://en.wikipedia.org/wiki/Tic-tac-toe).

26
votes
12answers
3k views

Determine Tic-Tac-Toe winner (round based)

Let's play some code-golf! The challenge is to find the winner of a game of Tic-Tac-Toe. This has been done many times by giving a board that has one clear winner but here is the twist: The cells ...
13
votes
2answers
545 views

Play tic-tac-toe and never lose

(There exists some challenges that require to use the best strategy, but here we don't. Even if you are able to win, you are allowed to make a tie) Challenge Write a program which plays the game tic-...
14
votes
15answers
2k views

Tic-Tac-Toe - X or O?

Background Skip to "Task" if you are familiar with Tic-Tac-Toe (I think most are!) Tic-Tac-Toe is a famous two-player game. It consists of a 3x3 board that is filled gradually by two players (...
9
votes
3answers
858 views

Tic Tac Toe: print all possible positions without duplicates

Write a program that outputs all possible Tic Tac Toe positions including the corresponding game outcome. Avoid duplicate output of equal positions. The program takes no input. Rules: A position ...
0
votes
0answers
63 views

Who won the game? [duplicate]

Task Everyone knows the game "Tic-Tac-Toe". Your task is it, to evaluate an ascii tic-tac-toe matchfield. Your Programm/Function should output/return the winner: O, X or nobody (N). Pattern ...
46
votes
15answers
9k views

Is this Tic-Tac-Toe board valid?

Challenge Given a tic-tac-toe board in any format, determine if it is valid or not. If a board can be the result of a tic-tac-toe game, then it is valid. For example, this board is valid:X O X O X O ...
9
votes
10answers
1k views

Print this tic-tac-toe board!

Here is a tic-tac-toe board: ...
18
votes
2answers
521 views

What's your next move?

This challenge is to write a minimax function in a language of your choice, to output the next best move in an NxN game of tic-tac-toe given the current board state. The board input can be accepted as ...
10
votes
2answers
509 views

Tic-tac-toe with only crosses as quick as possible

As per Luke's request and Peter Taylor's addition to this challenge. Introduction Everyone knows the game tic-tac-toe, but in this challenge, we are going to introduce a little twist. We are only ...
32
votes
6answers
1k views

Tic-tac-toe with only crosses

Introduction Everyone knows the game tic-tac-toe, but in this challenge, we are going to introduce a little twist. We are only going to use crosses. The first person who places three crosses in a row ...
37
votes
4answers
1k views

Let's play Meta tic-tac-toe!

Lets play a game of Meta tic-tac-toe! This is a king-of-the-hill tournament of Meta tic-tac-toe. The rules of Meta tic-tac-toe are as follows: All of the regular rules of tic-tac-toe apply. There ...
30
votes
2answers
2k views

Optimal Games of Tic Tac Torus

This challenge is about the game Tic Tac Toe, but it's played on a torus. How to play To create the necessary game board, you start out with a regular Tic Tac Toe game board. First fold it into a ...
6
votes
6answers
1k views

Tic Tac Toe encoder/decoder

James Bond is about to start a new mission and you are his computer scientist friend. As Tic Tac Toe is becoming more and more popular you decide that nothing would be more underhanded than a Tic Tac ...
8
votes
1answer
570 views

Tic-Tac-Toe and Chess, with fewest [distinct] characters

In this form of the game Tic-Tac-Chec, the goal is to move chess pieces to get four-in-a-row. Your goal here is to figure out if a position has a winning move. Rules The rules are similar, but not ...
15
votes
3answers
1k views

The Tic-tac-toe Games

Create a deterministic program to play nd tic-tac-toe with the other contestants. Your program should work when n (width) and d...
13
votes
3answers
971 views

Create an n to the d tic tac toe win-checker

Create the shortest program to check who has won in an nd tic tac toe game. Your program should work when n (width) and d (...
7
votes
1answer
579 views

Graphical, networked, two-(human)-player Tic-Tac-Toe

Create a Tic-Tac-Toe game that allows two human players to play against each other using two networked devices. Requirements: Network play. Program must let both players know whose turn it is. ...
9
votes
0answers
927 views

Output the correct move as per the XKCD tic-tac-toe cheetsheet! [closed]

Overview This is the XKCD tic-tac-toe cheetsheet: It's rather big, I know. But it's also your most valuable resource in your challenge. The challenge Create a program (in your language of choice) ...
7
votes
3answers
1k views

Tic Tac Tae Toe

(Better known as 3D Tic Tac Toe; I just made up a name that sounded catchy ;-) ) Let two people play this game against each other. Specifications: Output the easiest way of explaining this will be ...
3
votes
0answers
260 views

Variable board size 3D Connect Four [closed]

Write a 3D version (the game logic being 3D, not the visual representation) of the popular Connect Four game ( http://en.wikipedia.org/wiki/Connect_Four ) where the user can play against the computer. ...
17
votes
1answer
940 views

Lose at tic-tac-toe

Write a program that a will play a game of Misère tic-tac-toe. That is, the goal is to force your opponent to take three in a row. Accept on standard input either an 'X' or an 'O'(the letter, not ...
17
votes
7answers
2k views

The Tic Tac Toe Dictionary

A TicTacToe game can be represented by a string denoting the sequence of positions as the players make their move. 0 1 2 3 4 5 6 7 8 Assume ...
7
votes
4answers
2k views

Noughts and Crosses (aka Tic-Tac-Toe)

Write a Notes and Crosses application. User interface is optional. You can output the computers move in text: eg 1x1 (meaning ...