예제 #1
0
파일: index.php 프로젝트: bgrgicak/WarGame
if (isset($_GET['army1']) && isset($_GET['army2']) && is_numeric($_GET['army1']) && is_numeric($_GET['army2'])) {
    $battle = new battle(array($_GET['army1'], $_GET['army2']));
    //start battle
    $time_end = microtime(true);
    $execution_time = (int) (($time_end - $time_start) * 1000);
    ?>
		<div id="score">
			<p class="title">
				Army<?php 
    echo $battle->winner();
    ?>
 won
			</p>
			<p class="text">
				<?php 
    echo $battle->winnerCount();
    ?>
 warriors survived
			</p>
			<p class="text">
				The battle lasted for <?php 
    echo $execution_time;
    ?>
 milliseconds
			</p>
		</div>
		<form id="retry">
			<label>Army1: </label>
			<input name="army1"  placeholder="number of warriors" value="<?php 
    if (isset($_GET['army1'])) {
        echo $_GET['army1'];