hacking exercise PHP Peru
- a player can take a field if not already taken
- players take turns taking fields until the game is over
- a game is over when all fields are taken
- a game is over when all fields in a column are taken by a player
- a game is over when all fields in a row are taken by a player
- a game is over when all fields in a diagonal are taken by a player
source: http://gojko.net/2009/08/02/tdd-as-if-you-meant-it-revisited/
we are trying to lay out the problem in the best way so it will be expandable later on. The first approach now is to identify first the process backbone of the game, then apply events to expand it and perhaps other patterns such as workflow pattern.
So far we have split into several files already the existent code which is best for organization. And we have already used the help initial TDD provided. We will comply with the feature context scenarios however the development now has gone beyond this point so we are not limited by the scope of TDD.
git clone http://github.com/phpperu/TicTacToe-Best-Practices-Project.git tictactoe
cd tictactoe
wget http://getcomposer.org/composer.phar
php composer.phar install
./develop
- use events for turnSwitcher
- use validatorBoard for AI insertion
- board class has non-fixed dimensions
- validatePosition fetch field from global sack and if it returns null it means it's owned by someone else already
- SPL reuse for adding players
- SPL reuse for polling global and player sacks
IRC channel: #phpperu on irc.freenode.net
PHPPeru is now a github organization