Exemple #1
0
<?php

include_once "config.php";
include "life.php";
if ($_SESSION['turn'] == 0) {
    echo form();
} else {
    if ($_SESSION['turn'] > 0) {
        echo world();
        $_SESSION['turn']++;
        apply_rules();
    }
}
function form()
{
    $string = "<form method='POST' action='populate.php'><table>";
    for ($y = 0; $y < SIZE; $y++) {
        $string = $string . "<tr>";
        for ($x = 0; $x < SIZE; $x++) {
            $arr = [];
            $arr = array($x, $y);
            $string = $string . "<td id ='" . $x . "xy{$y}' title='({$x},{$y})'\n                                 style='width:" . CELL_SIZE . "px;height:" . CELL_SIZE . "px;border:solid 1px black;'>\n        \t\t\t\t       <input name='" . $x . "xy{$y}' type='checkbox'  value='" . json_encode($arr) . "'/>\n        \t\t\t           </td>";
        }
        $string = $string . "</tr>";
    }
    $string = $string . "</table><input type='submit' /></form>";
    return $string;
}
function world()
{
    $string = "<table id='relevant_table'>";
Exemple #2
0
 /**
  * A validation rule that checks the validity of a world.
  *
  * @param  string  $attribute
  * @param  mixed  $value
  * @param  array  $parameters
  * @return void
  */
 public function validateWorld($attribute, $value, array $parameters)
 {
     return (bool) world($value);
 }
Exemple #3
0
 /**
  * Retrieve the player world.
  *
  * @return \Apolune\Contracts\Server\World
  */
 public function world()
 {
     if ($this->hasColumn('world_id')) {
         return world($this->world_id);
     }
     return worlds()->first();
 }