-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.php
35 lines (28 loc) · 1.05 KB
/
index.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
<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once('helpers/helper_functions.php');
require_once('models/ChessRulebook.php');
require_once('models/ChessBoard.php');
require_once('models/ChessPiece.php');
require_once('models/ChessMove.php');
require_once('models/ChessSquare.php');
$board = new ChessBoard();
if ( isset($_GET['reset']) ) {
// Skip this conditional. ChessGame's FEN is the default, new game FEN and doesn't need to be set again.
} elseif ( isset($_GET['move']) ) {
$board->import_fen($_GET['move']);
} elseif ( isset($_GET['fen']) ) {
$board->import_fen($_GET['fen']);
}
$fen = $board->export_fen();
$side_to_move = $board->get_side_to_move_string();
$who_is_winning = $board->get_who_is_winning_string();
$graphical_board_array = $board->get_graphical_board();
$legal_moves = ChessRulebook::get_legal_moves_list($board->color_to_move, $board);
define('VIEWER', true);
require_once('views/index.php');