Tic Tac Toe

版本 1.1.0.0 (6.5 KB) 作者: Suleman Shafqat
Traditional tictactoe game, using Graphics User Interface.
4.0K 次下载
更新时间 2011/3/24

查看许可证

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)

引用格式

Suleman Shafqat (2024). Tic Tac Toe (https://www.mathworks.com/matlabcentral/fileexchange/30633-tic-tac-toe), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2009b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Strategy & Logic 的更多信息
致谢

启发作品: 3 Player TicTacToe

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.1.0.0

Details added for description and learning point of view.

1.0.0.0