View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Tic Tac Toe

5.0 | 2 ratings Rate this file 19 Downloads (last 30 days) File Size: 6.55 KB File ID: #30633 Version: 1.1
image thumbnail

Tic Tac Toe



04 Mar 2011 (Updated )

Traditional tictactoe game, using Graphics User Interface.

| Watch this File

File Information

A 2D matrix is declared and initialized with zeros, as any player turns, the corresponding 1 or 2 is written in the matrix.
After each turn the matrix is checked in function "whowins.m", with any number (1 or 2) coming three in line, that number is returned other wise '0', if -1 is returned it means its a draw.

winning logic simply checks all possible options a player can win and the corresponding function is called after each turn.
The 2D array is updated each turn and whowins.m is checking that for all three cases (player 1 wins, player 2 wins and Draw)


This file inspired 3 Player Tic Tac Toe.

MATLAB release MATLAB 7.9 (R2009b)
Other requirements GUI
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
30 May 2012 Suleman Shafqat

A new version of tic tac toe is coming up soon. It will be named as Advanced TicTacToe. More options, new invention, efficient code ;-)

Comment only
30 Nov 2011 Muhammad Hussain

good work....

17 May 2011 Suleman Shafqat

thanks D.B. Do check my other game that is CHESS MASTER

Comment only
07 May 2011 David Buckingham

this is very nice. i wish it asked if i wanted to play another game at the end instead of closing. i also wish it didn't throw all those error messages at the end. i meant to put 5 stars but accidentally did 4. sorry. ill try to change it.

Comment only
07 May 2011 David Buckingham

24 Mar 2011 1.1

Details added for description and learning point of view.

Contact us