Here's a sample code to create a Tic Tac Toe game (also known as X and O game) in MATLAB using a function which takes a 3x3 matrix as input and returns the winner (if there is one).
main.m836 chars39 lines
You can test this function by passing in a 3x3 matrix representing the board, where empty cells are represented by a period .
like so:
main.m84 chars5 lines
Output:
main.m8 chars2 lines
gistlibby LogSnag