Esempio n. 1
0
 function travel($node, $tree)
 {
     $total = array();
     foreach ($tree[$node] as $v) {
         $branch = array();
         if (!isset($tree[$v])) {
             $branch['value'] = 1000;
         } else {
             $branch['children'] = travel($v, $tree);
         }
         $branch['name'] = $v;
         array_push($total, $branch);
     }
     return $total;
 }
Esempio n. 2
0
function travel(&$out, $n = 0, $i = 0, $j = 0, $depth = 1)
{
    // $is_inner = ($depth == 0) ? 0 : 2;
    // ->
    draw($out, $i, $j, $i, $j + ($n - 1));
    $j += $n - 1;
    // down
    draw($out, $i, $j, $i + ($n - 1), $j);
    $i += $n - 1;
    // <-
    draw($out, $i, $j, $i, $j - ($n - 1));
    $j -= $n - 1;
    // up
    draw($out, $i, $j, $i - ($n - 3), $j);
    $i -= $n - 3;
    $j += 1;
    draw($out, $i, $j, $i, $j);
    // if ($depth == 2) return;
    if ($n - 4 < 0) {
        return;
    }
    $depth++;
    travel($out, $n - 4, $i, $j + 1, $depth++);
}
Esempio n. 3
0
        $req = mysql_query($res);
        if (!$req) {
            echo "<B>Error " . mysql_errno() . " :</B> " . mysql_error() . "";
            exit;
        }
        header('Location: travel.php');
        ?>
		<script language=javascript>
		self.location="town.php"
		</script>
		<?php 
    }
}
if (@$_POST['travel']) {
    $id = $_POST['travel'];
    travel($character->id, $character->gold, $id);
}
?>
<table width="550" border="1" cellspacing="0" cellpadding="3" align="center">
<tr style=background:#006600;>
<td colspan="2">
<div align="center"><b>Available Ports</b></div>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<form><input type='button' onClick="location='travel.php'" value='Back to Map'></form>
</td>
</tr>
<tr>
<td><table><tr><td>Destination</td><td>&nbsp;&nbsp;</td><td>Cost</td><td>&nbsp;&nbsp;</td></tr>
Esempio n. 4
0
<?php

include "globals.php";
include "travellingglobals.php";
switch ($_GET['action']) {
    case "pickcity":
        pickcity();
        break;
    case "travel":
        travel();
        break;
    default:
        index();
        break;
}
function index()
{
    global $db, $ir, $c, $h, $set, $userid;
    echo '

<div class="generalinfo_txt">
<div><img src="images/info_left.jpg"alt=""/></div>
<div class="info_mid"><h2 style="padding-top:10px;"> <h3>Welcome to the ' . $set['game_name'] . ' Travel Center<br /> </h3></div>
<div><img src="images/info_right.jpg"alt=""/></div> </div>
<div class="generalinfo_simple"><br> <br><br>

<h3>How would you like to travel today?</h3>
    
<table width="90%" class="table"><tr><th colspan="3">Choose your preferred method of travel from the options below. Please be aware that different modes of travel have different costs and the travel times will vary.</th></tr>
<th>Plane</th><th>Train</th><th>Automobile</th>
<tr>
Esempio n. 5
0
<head>
<style>
body { font-family: "Courier New"; }
</style>
</head>
<body>
<?php 
$startX = 1;
$startY = 1;
$currentX = $startX;
$currentY = $startY;
$endX = 9;
$endY = 9;
$map = createMap(10, 10);
$dirDice = array("Forward", "Backward", "Left", "Right");
travel($endX, $endY, 100);
displayMap($map);
function move($move)
{
    global $map, $currentX, $currentY, $dirDice;
    $invalidMove = true;
    $tmpDice = array_merge(array(), $dirDice);
    while ($invalidMove) {
        $tmpX = $currentX;
        $tmpY = $currentY;
        if (!empty($tmpDice)) {
            $index = array_rand($tmpDice, 1);
            $direction = $tmpDice[$index];
            if ($direction == "Forward") {
                $tmpX--;
            } else {