-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.php
45 lines (37 loc) · 805 Bytes
/
main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env php
<?php
// Let the game begin!
require 'bootstrap.php';
chooseGameMode:
printInfo("
Connect4 Game!
Please choose a game mode.
1) Human vs Human
2) Human vs AI
3) AI vs AI
" . getExitInstruction());
$gameMode = readline("Enter 1, 2 or 3: ");
if (!in_array($gameMode, [1, 2, 3]))
{
printError("Invalid selection.");
goto chooseGameMode;
}
/** @var \Connect4\Game $game */
switch ($gameMode)
{
case 1:
$game = $container->make('connect4.game.human.vs.human');
break;
case 2:
$game = $container->make('connect4.game.human.vs.ai');
break;
case 3:
$game = $container->make('connect4.game.ai.vs.ai');
break;
default:
goto chooseGameMode;
break;
}
$game->setup();
$game->start();
goto chooseGameMode;