forked from jlbooker/hangman
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
35 lines (29 loc) · 642 Bytes
/
index.php
File metadata and controls
35 lines (29 loc) · 642 Bytes
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
<?php
//Creates new hangman object to generate logic.
$hangman = new Hangman();
//Determines if it is a new game or if the user has guessed. If they have, it updates the game accordingly.
if (isset($_GET['action']))
{
$action = $_GET['action'];
}
else
{
$action = '';
}
switch ($action)
{
case 'new_game':
$hangman->startGame();
break;
case 'guess':
$hangman->showGame();
$hangman->restoreGame();
break;
default:
$this->startGame();
break;
}
//Creates and displays a hangview object to display hangman onto an html template.
$view = new HangView($hangman);
$view->show();
?>