0) {
list($bestMoves, $byName, $solution) = mysql_fetch_row($result);
echo " Best solution for this map: $bestMoves by $byName";
//$map = MergeMapSolution($motd['map'], $solution);
$map = MergeMapSolution($map, $solution);
echo DisplayMap($map, $mapID);
echo " ";
echo " Is Current:";
$is = isCurrentMap(77);
echo " $is";
$is = isCurrentMap(20);
echo " $is";
$is = isCurrentMap(76);
echo " $is";
$is = isCurrentMap(75);
echo " $is";
$is = isCurrentMap(74);
echo " $is";
echo " ";
}
function isCurrentMap($mapID) {
include_once('./includes/db.inc.php');
$sql = "SELECT `ID` FROM `mapOfTheDay`
WHERE `mapDate` = CURDATE() AND
`mapID` = '$mapID'
";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) == 0)
return false;
else
return true;
}
echo " ";
echo " ";
echo " Solution before";
echo " ";
echo $solution;
echo " ";
echo " Solution after";
echo " ";
$solution = formSolution($solution);
echo $solution;
echo " ";
echo " ";
echo " ";
// echo " The map for today:
// Once logged in your best solutions for the map(s) are saved.
// - Soon i'll fix it so you can see those solutions, and compare them with others.
// - New maps are generated daily, at 9:00 PM Pacific Standard. (for now...)
// ";
// echo DisplayMap($motd['map'], $motd['id']);
function createThumbnail($mapMatrix, $idprefix, $width, $height) {
//Iterate through $mapMatrix and generate the html
$maptable = ""; //The string to return to the database.
$index = 0; //The current number of tiles from the last tile saved.
for( $i = 1; $i < count($mapMatrix); $i++)
{
$maptable .= "";
for( $j = 0; $j < count($mapMatrix[$i]); $j++)
{
//==
$index++;
$handle = "$idprefix,$i,$j";
switch($mapMatrix[$i][$j])
{
case 's': $maptable .= " "; break;
case 'f': $maptable .= " "; break;
case 't': $maptable .= " "; break;
//case 't': $maptable .= " "; break;
case 'u': $maptable .= " "; break;
case 'm': $maptable .= " "; break;
case 'n': $maptable .= " "; break;
case 'a': $maptable .= " "; break;
case 'b': $maptable .= " "; break;
case 'c': $maptable .= " "; break;
case 'd': $maptable .= " "; break;
case 'e': $maptable .= " "; break;
case 'r': $maptable .= " "; break; //rock
case 'w': $maptable .= " "; break; //wall
//default: $maptable .= "".$index." ";
default: $maptable .= " ";
//default: $maptable .= "".$mapMatrix[$i][$j]." ";
}
}
$maptable .= " ";
}
//Prepare mapdata.
$mapdata['height'] = $mapMatrix[0][0];
$mapdata['width'] = $mapMatrix[0][1];
$mapdata['points'] = $mapMatrix[0][2];
$mapdata['rocks'] = $mapMatrix[0][3];
$mapdata['walls'] = $mapMatrix[0][4];
$mapdata['teleports'] = $mapMatrix[0][5];
$mapdata['example'] = $example;
$mapdata['mapid'] = $idprefix;
$path = routePath($mapMatrix, '');
$mapdata['code'] = GenerateMapCode($mapMatrix);
$width = (($j * 35) + 2).'px';
//$width = (($j * 23) + 2).'px';
$i -= 1;
$height = (($i * 35)).'px';
//$height = (($i * 22) + 2).'px';
$jsonmap = json_encode($mapdata);
$mapdatadiv .= "";
$mapdatadiv .= $jsonmap;
$mapdatadiv .= '
';
$maptable = "";
if ($example) {
$output = $maptable;
$output .= " ";
$output .= "
";
$output .= $mapdatadiv;
$output = "
$output
";
return $output;
}
$output = "
";
return $output;
}
htmlFooter();
?>