Is this a valid Tic Tac Toe State? - MATLAB Cody - MATLAB Central

Problem 44364. Is this a valid Tic Tac Toe State?

Difficulty:Rate

For the game of Tic Tac Toe we will be storing the state of the game in a matrix M.

For this game:

We would store the state as this:

-1  1  1 
 1 -1 -1
 1 -1 -1

If there were any blanks squares, they would be 0;

For this challenge, X goes first. Neither side is compelled to take a win if possible. The game stops when either player wins.

For this challenge, is the the given board state 0: legal 1: this state can not occur in a game

The example in the image would return 0 because if X goes first there can never be more O than X. The state matrix will only hold [-1 0 1], so we are only checking for logic of the game.

Solution Stats

29.86% Correct | 70.14% Incorrect
Last Solution submitted on Feb 13, 2025

Problem Comments

Solution Comments

Show comments
Primes and Rough Numbers, Basic ideas
What is a rough number? What can they be used...
3
5

Problem Recent Solvers120

Suggested Problems

More from this Author51

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page