MD_TTT Library  1.0
TicTacToe Game Decision Engine Library
Arduino TicTacToe game decision engine library

The motivation for this library is to explore the separation between the algorithm for managing a game and the user interface for the game. Discovering a TicTacToe algorithm simple enough to implement on the Arduino allows an exploration of this concept with simple user interface requirements.

The integration between game library and user interface is largely implemented through a callback function that allows the user program to update each game cell as the game progresses, without needing detailed knowledge of the game board and current positions. The example programs supplied provide a framework that can be changed for alternative user interfaces.

The code implements an elegant algorithm that is briefly described in the blog referenced with some additional features to make decisions easier to implement in code.

The only call required while running the game is to the library function doMove().

Topics

References

Xeda112358, ‘Tic-Tac-Toe algorithm’, blog on 26 March, 2012, 17:43:57, accessed at http://www.omnimaga.org/math-and-science/tic-tac-toe-algorithm/

Revision History

March 2013 - version 1.0

  • Initial implementation

Copyright

Copyright (C) 2013 Marco Colli. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA