Example #1
0
 /**
  * @param array $fields
  * @param mixed $expected
  * @dataProvider combinationDataProvider
  */
 public function testFindWinner(array $fields, $expected)
 {
     $board = new Board($fields);
     $player1 = new Player('Bob', new RandomStrategy());
     $player2 = new Player('Joe', new RandomStrategy());
     $game = new Game($board, $player1, $player2);
     $this->assertSame($expected, $game->findWinner());
 }
Example #2
0
<?php

/**
 * Start the Game
 */
use TickTackToe\Game;
use TickTackToe\Board;
use TickTackToe\Player;
use TickTackToe\Strategy\RandomStrategy;
require "vendor/autoload.php";
$board = new Board();
$player1 = new Player('Bob', new RandomStrategy());
$player2 = new Player('Joe', new RandomStrategy());
$game = new Game($board, $player1, $player2);
$winner = $game->start();
dump($winner);
dump($game->getNumberOfMoves());