summaryrefslogtreecommitdiffstats
path: root/pages/gallery.php
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-01-25 00:26:07 -0800
committerPatrick Davison <snapwilliam@gmail.com>2013-01-25 00:26:07 -0800
commitae5c6c5800f39ef169986e59e69b43241ccf3902 (patch)
treeb8428e9376c767176dee427855664fbf6102ca1f /pages/gallery.php
parent54aac45cafb3df1bd1e31177d4f38750f495e908 (diff)
downloadpathery-ae5c6c5800f39ef169986e59e69b43241ccf3902.tar.xz
Added missing files, deleted some old files.
Diffstat (limited to 'pages/gallery.php')
-rw-r--r--pages/gallery.php692
1 files changed, 0 insertions, 692 deletions
diff --git a/pages/gallery.php b/pages/gallery.php
deleted file mode 100644
index fce6256..0000000
--- a/pages/gallery.php
+++ /dev/null
@@ -1,692 +0,0 @@
-<?PHP
-htmlHeader(array(), '', '', array('scores'));
-
-include_once ('./includes/sqlEmbedded.php');
-if ($accepted) {
- $userID = $_SESSION['userID'];
-
- $sql = "
- SELECT
- userData.wallColor,
- userData.wallEmblem
- FROM `userData`
- WHERE userID = '$userID' ";
- $result = mysql_query($sql);
- if ($result)
- list($wallColor, $wallEmblem) = mysql_fetch_row($result);
-}
-?>
-
-<body>
-<script type="text/javascript">
-playerWallColor = '<?PHP echo isset($wallColor) ? $wallColor : ''; ?>';
-playerWallEmblem = '<?PHP echo isset($wallEmblem) ? $wallEmblem : ''; ?>';
-</script>
-<?php
-topbar($Links);
-
-include('./includes/maps.php');
-include('./includes/mapoftheday.php');
-
-//$map = getRandomSpecialMap();
-//$map = getRandomWeeklyMap();
-//$map = getRandomComplexMap();
-echo "<br />";
-echo soundManager2();
-
-
-$spin[] = 'ooooooooooooooo';
-$spin[] = 'oooooororoooooo';
-$spin[] = 'ooooooooooooooo';
-$spin[] = 'uoooroormoroooo';
-$spin[] = 'soooooratooooof';
-$spin[] = 'noooooororooooo';
-$spin[] = 'ooooorooooooooo';
-$spin[] = 'oooooooroororoo';
-$spin[] = 'ooooooooooooooo';
-
-
-$myparams['checkpoints'] = 3;
-$myparams['teleports'] = 1;
-$myparams['rockchance'] = 2000;
-$myparams['walls'] = 12;
-$myparams['name'] = 'Round and Round';
-
-$map = GenerateShapedMap($spin, $myparams);
-
-include('./includes/mapclass.php');
-
-$mapCode = GenerateMapCode($map);
-echo $mapCode;
-echo "<br>";
-echo "<br>";
-
-$mapClass = new map($mapCode);
-echo DisplayMapThumbnail($mapClass);
-
-echo "<br>";
-echo "<br>";
-echo $mapClass->width;
-echo "<br>";
-echo $mapClass;
-echo "<br>";
-echo "<br>";
-var_dump($mapClass);
-echo "<br>";
-echo TileStart;
-echo TileFinish;
-echo "<br>";
-
-exit;
-
-
-echo DisplayMap($map, 2);
-
-//addNewChallengeMap($map, 0, 0, 'Round and Round');
-
-//addNewChallenge(1194, "greater than", 163, 1, "Make it go around and around and around");
-//addNewChallenge(1194, "greater than", 161, 1, "Make it go around and around and around", 11);
-//addNewChallenge(1194, "greater than", 173, 1, "Make it go around and around and around");
-
-exit;
-
-
-//Add's a new custom challenge map - returns mapid
-function addNewChallengeMap($map, $tier, $subOrder, $name) {
- $mapcode = GenerateMapCode($map);
-
- $sql = "INSERT INTO `maps`
- (`code`, `isChallenge`, `ChallengeTier`, `ChallengeSuborder`, `ChallengeName`)
- VALUES
- ('$mapcode', true, $tier, $subOrder, '$name')";
-
- echo $sql;
- mysql_query($sql);
- $mapID = mysql_insert_id();
- return $mapID;
-}
-
-//Returns challenge ID
-function addNewChallenge($mapID, $inequality, $goal, $ordering, $hint,
- $restrictWallCount = null, $restrictWallPlacement = null, $restrictTeleportCount = null,
- $restrictTeleportsUsed = null, $restrictStartPoint = null, $restrictEndPoint = null) {
-
- $sql = "INSERT INTO `challenges` (
- `mapID`, `inequality`, `goal`, `ordering`, `hint`,
- `restrictWallCount`, `restrictWallPlacement`, `restrictTeleportCount`,
- `restrictTeleportsUsed`, `restrictStartPoint`, `restrictEndPoint`
- )
- VALUES (
- '$mapID', '$inequality', $goal, $ordering, '$hint',
- '$restrictWallCount', '$restrictWallPlacement', '$restrictTeleportCount',
- '$restrictTeleportsUsed', '$restrictStartPoint', '$restrictEndPoint'
- )";
-
- echo $sql;
- mysql_query($sql);
- $challengeID = mysql_insert_id();
- return $challengeID;
-}
-
-
-$reversePath[] = 'fo????????????oS';
-$reversePath[] = 'fo????????????oS';
-$reversePath[] = 'fo????????????oS';
-$reversePath[] = 'fo????????????oS';
-$reversePath[] = 'fo????????????oS';
-$reversePath[] = 'fo????????????oS';
-$reversePath[] = 'fo????????????oS';
-
-$reversePath = insertPoint($reversePath, 'abc');
-
-$myparams['checkpoints'] = 3;
-$myparams['teleports'] = 0;
-$myparams['rockchance'] = 7;
-$myparams['walls'] = 12;
-$myparams['name'] = 'Dualing paths';
-
-//$map = GenerateShapedMap($reversePath, $myparams);
-
-$dualingPaths[] = 'so??????????????xf';
-$dualingPaths[] = 'so??????????????xf';
-$dualingPaths[] = 'so??????????????xf';
-$dualingPaths[] = 'so??????????????xf';
-$dualingPaths[] = 'Xo??????????????ox';
-$dualingPaths[] = 'fX??????????????oS';
-$dualingPaths[] = 'fX??????????????oS';
-$dualingPaths[] = 'fX??????????????oS';
-$dualingPaths[] = 'fX??????????????oS';
-
-$dualingPaths = insertPoint($dualingPaths, 'abc');
-$dualingPaths = insertPoint($dualingPaths, weight('x', 'xx', 'xxx').weight('X', 'XX', 'XXX'));
-
-$myparams['checkpoints'] = 3;
-$myparams['teleports'] = 0;
-$myparams['rockchance'] = 9;
-$myparams['walls'] = 12;
-$myparams['name'] = 'Dualing paths';
-
-$map = GenerateShapedMap($dualingPaths, $myparams);
-echo DisplayMap($map, 1);
-
-
-
-$unlimited[] = 'so?o?o?o?o?o?o?of';
-$unlimited[] = 's???????????????f';
-$unlimited[] = 'so?????????????of';
-$unlimited[] = 's???????????????f';
-$unlimited[] = 'so?????????????of';
-$unlimited[] = 's???????????????f';
-$unlimited[] = 'so?????????????of';
-$unlimited[] = 's???????????????f';
-$unlimited[] = 'so?o?o?o?o?o?o?of';
-
-$unlimited = insertPoint($unlimited, 'abc');
-$unlimited = insertPoint($unlimited, weight('tu', 'dtu'));
-
-$myparams['checkpoints'] = 3;
-$myparams['teleports'] = 1;
-$myparams['rockchance'] = 9;
-$myparams['walls'] = 999;
-$myparams['name'] = 'Unlimited';
-
-$map = GenerateShapedMap($unlimited, $myparams);
-
-
-echo "<br />";
-echo soundManager2();
-echo DisplayMap($map, 2);
-
-htmlfooter();
-exit;
-
-//$map = GenerateShapedMap($dualingPaths, $myparams);
-
-//$map = getRandomSpecialMap();
-//$map = getRandomComplexMap();
-
- // DUALING PATHS MAP
-
-
-
-$openmaps[] = 'SouooooooXoooooooXooooxf';
-$openmaps[] = 'oooooooooXoooooooXooooox';
-$openmaps[] = 'oooooooooxooooooeXcooooo';
-$openmaps[] = 'oooooooooxoooooooXoooooo';
-$openmaps[] = 'oooooooooxaoootooXoooooo';
-$openmaps[] = 'oooooooooxxxxxxxxxoooooo';
-$openmaps[] = 'oooooooooooooooooooooooo';
-$openmaps[] = 'oooooooooooooooooooooooo';
-$openmaps[] = 'Xooooobdoooooooooooooooo';
-$openmaps[] = 'fXooooooooooooooooooooos';
-
-$myparams['checkpoints'] = 5;
-$myparams['teleports'] = 0;
-$myparams['rockchance'] = 15;
-$myparams['walls'] = 38;
-$myparams['name'] = 'Dualing Starts';
-
-//$map = GenerateShapedMap($openmaps, $myparams);
-
-//echo DisplayMap($map, 1);
-
-?>
-<script src="sounds/script/soundmanager.js"></script>
-<script type="text/javascript">soundManagerInit();</script>
-<?
-
-exit;
-
-
-
-$basic3[] = "orooooooooof";
-$basic3[] = "orooooooooof";
-$basic3[] = "oroooaooooof";
-$basic3[] = "soroooooooof";
-$basic3[] = "ooooroooooof";
-$basic3[] = "uoooortoooof";
-$basic3[] = "usooooooooof";
-$basic3[] = "uoooooooooof";
-
-
-$myparams['checkpoints'] = 1;
-$myparams['teleports'] = 0;
-$myparams['rockchance'] = 100;
-$myparams['walls'] = 3;
-
-//$map = GenerateShapedMap($basic3, $myparams);
-
-//Dual map
-$dualmapa[] = "s??????????????????tc";
-$dualmapa[] = "s??????????????????tc";
-$dualmapa[] = "s??????????????????tc";
-$dualmapa[] = "s??????????????????tc";
-$dualmapa[] = "s??????????????????tc";
-$dualmapa[] = "s??????????????????tc";
-$dualmapa[] = "qqqqqqqqqqqoqqqqqqqqq";
-$dualmapb[] = "u???????????????????f";
-$dualmapb[] = "u???????????????????f";
-$dualmapb[] = "u???????????????????f";
-$dualmapb[] = "u???????????????????f";
-$dualmapb[] = "u???????????????????f";
-$dualmapb[] = "u???????????????????f";
-
-$dualmapa = insertPoint($dualmapa, 'ab');
-$dualmapb = insertPoint($dualmapb, 'cde');
-$dualmap = array_merge($dualmapa, $dualmapb);
-//$dualmap = insertPoint($dualmap, 'vw');
-
-$myparams['checkpoints'] = 3;
-$myparams['teleports'] = 1;
-$myparams['rockchance'] = 9;
-$myparams['walls'] = weight(20, 20, 21, 21, 22, 23);
-$myparams['name'] = 'Seeing Double';
-//$map = GenerateShapedMap($dualmap, $myparams);
-
-
-$dualsmap[] = 'rSrSrSrSrSrSr';
-$dualsmap[] = 's???????????f';
-$dualsmap[] = 'r???????????r';
-$dualsmap[] = 's???????????f';
-$dualsmap[] = 'r???????????r';
-$dualsmap[] = 's???????????f';
-$dualsmap[] = 'r???????????r';
-$dualsmap[] = 's???????????f';
-$dualsmap[] = 'rfrfrfrfrfrfr';
-
-$dualsmape[] = 'rSrSrSoroSrSrSr';
-$dualsmape[] = 'sooooooooorooof';
-$dualsmape[] = 'roootooooooooor';
-$dualsmape[] = 'soooorooorbroof';
-$dualsmape[] = 'roroaooooooroor';
-$dualsmape[] = 'sooooooooooooof';
-$dualsmape[] = 'roooooorcuoooor';
-$dualsmape[] = 'sooooooooooooof';
-$dualsmape[] = 'rooooooooooooor';
-$dualsmape[] = 'sooooooooooooof';
-$dualsmape[] = 'rooooooooooooor';
-$dualsmape[] = 'sooooooooooooof';
-$dualsmape[] = 'rfrfrforofrfrfr';
-
-
-
-echo "Prep..";
-
-$ultraComplex[] = "soooooooooooooooooooooooooooor";
-$ultraComplex[] = "ro??????????????????????????of";
-$ultraComplex[] = "so??????????????????????????or";
-$ultraComplex[] = "ro??????????????????????????of";
-$ultraComplex[] = "so??????????????????????????or";
-$ultraComplex[] = "ro??????????????????????????of";
-$ultraComplex[] = "so??????????????????????????or";
-$ultraComplex[] = "ro??????????????????????????of";
-$ultraComplex[] = "so??????????????????????????or";
-$ultraComplex[] = "ro??????????????????????????of";
-$ultraComplex[] = "so??????????????????????????or";
-$ultraComplex[] = "roooooooooooooooooooooooooooof";
-
-$ultraComplex = insertPoint($ultraComplex, 'abcde');
-$ultraComplex = insertPoint($ultraComplex, 'tumngh');
-$ultraComplex = insertPoint($ultraComplex, 'ppppppppppp');
-
-$myparams['checkpoints'] = 5;
-$myparams['teleports'] = 3;
-$myparams['rockchance'] = 9;
-$myparams['walls'] = 38;
-$myparams['name'] = 'Ultra Complex';
-
-echo "Gen..";
-
-$map = GenerateShapedMap($ultraComplex, $myparams);
-
-echo "Disp..";
-
-echo DisplayMap($map, 1);
-
-
-
-exit;
-
-if( ini_get('safe_mode') ){
- echo "RISM";
-} else {
- echo "NRISM";
-}
-ini_set('display_errors',1);
- error_reporting(E_NOTICE);
-
- //trigger_error("Cannot divide by zero", E_NOTICE);
-
-echo ini_get('max_execution_time');
-echo ":";
-
-if (isset($_GET['walls'])) {
- $map[0][4] = ($_GET['walls'] * 1);
-}
-
-//Benchmark
-$time_start = microtime(true);
-
-set_time_limit(70020);
-$newmap = executeTryMaze($map);
-echo DisplayMap($newmap, 2);
-
-
-$time_end = microtime(true);
-$time = round($time_end - $time_start, 4);
-echo "<br />Solution created in $time seconds\n<br />";
-
-//Return an array of affected tiles.
-function getAffected($route) {
- //Determin starting location.
- $start = explode(",", $route['start']);
- $x=$start[0];
- $y=$start[1];
-
- $tog = false;
-
- //Run through the path
- $pathary = str_split($route['path']);
- //echo "path:".$route['path'];
- foreach ($pathary as $position => $char) {
-
- switch($char) {
- case 'u': //tp1
- case 'n': //tp2
- case 'h': //tp3
- case 'j': //tp4
- case 'l': //tp5
- if ($tog == true) {
- $tog = false;
- continue;
- }
- $tog = true;
- //Get teleport coords
- $tmp = split($char, $route['path']);
- $loc = split(',', $tmp[1]);
- $x = $loc[0];
- $y = $loc[1];
- //echo "....$x,$y....";
- }
- if ($tog == true)
- continue;
-
- switch($char) {
- case 1: $y--; break; //up
- case 2: $x++; break; //right
- case 3: $y++; break; //down
- case 4: $x--; break; //left
- default: continue 2;
- }
- //add the positions
- $affected["$y,$x"]++;
- }
- //arsort($affected);
- return $affected;
-}
-// http://awesomescreenshot.com/0d7nyx9b2
-
-function executeTryMaze($mapMatrix, $intensity = 1) {
- $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];
- //Override hack.
- //$mapdata['walls'] = 12;
- $mapdata['teleports'] = $mapMatrix[0][5];
-
-
- $routes = 0;
-
- //PROCSES BEGIN
- $wallcount = 0;
- $iterations = 0;
- $lastRefresh = 0;
- do {
- $iterations++;
- $done = false;
- $path = routePath($mapMatrix);
- $routes++;
- $affected = getAffected($path);
-
- $curcount = 1000;
- $bestmoves = 0;
- $bestcount = 0;
-
- foreach ($affected as $position => $count) {
- //Find location
- $loc = explode(",", $position);
- $x=$loc[0];
- $y=$loc[1];
- //Is it open?
- if ($mapMatrix[$x][$y] != "o") {
- continue;
- }
-
-
- //Set a wall and calculate the new path
- $mapMatrix[$x][$y] = 'R';
- $curpath = routePath($mapMatrix);
- $routes++;
- $trymoves = $curpath['moves'];
-
- //if ("$x,$y" == "3,17") {
- //echo "T($x,$y)\n:";
- //print_r($affected);
- //return;
- //}
- //path blocked?
- if ($curpath['blocked'] == true) {
- //Sometimes it's better to remove a different wall;
-
- //Put a wall here.
- //if ($iterations % 8 == 4) {
- if (1 == 12) {
- $arrayWalls[$x][$y] = true;
-
- //determin wall values.
- $walllist = wallvalues($mapMatrix, $arrayWalls);
- $routes++;
-
- //Put the best wall to remove on top; - A mono directional bubble sort would be better here.
- $walllist["$x,$y"]--;
- asort($walllist);
-
- //Get location of wall to remove.
- $nwallposition = key($walllist);
-
- echo "*$nwallposition vs $x,$y*\n";
-
- $nloc = explode(",", $nwallposition);
- $bx=$nloc[0];
- $by=$nloc[1];
-
-
- $mapMatrix[$bx][$by] = 'R';
- $mapMatrix[$x][$y] = 'o';
- // $tmp = routePath($mapMatrix);
- // if ($tmp['blocked']) {
- // $mapMatrix[$bx][$by] = 'R';
- // $mapMatrix[$x][$y] = 'o';
- // echo "Unblocked";
- // continue;
- // }
- unset($arrayWalls[$bx][$by]);
- continue;
- }
- $mapMatrix[$x][$y] = 'o';
- continue;
- }
- //The last choice, or first choice?
- //if ($trymoves >= $bestmoves) {
- //echo "[$x, $y: $trymoves]";
- if ($trymoves > $bestmoves OR ($trymoves >= $bestmoves AND $bestcount <= $count) ) {
- $bestcount = $count;
- $bestmoves = $trymoves;
- $bestx = $x;
- $besty = $y;
- $mapMatrix[$x][$y] = 'o';
- //break;
- }
- $mapMatrix[$x][$y] = 'o';
- }
- //Place the wall in the best spot we found;
- $arrayWalls[$bestx][$besty] = true;
- echo $mapMatrix[$bestx][$besty];
- $mapMatrix[$bestx][$besty] = 'R';
- $wallcount++;
- echo "B($bestx,$besty)\n:";
-
- //Refresh walls (Remove obsolete walls)
- if ($iterations % 2 == 0 AND $wallcount > ($mapdata['walls'] * .6))
- {
- echo "RW";
- $walllist = wallvalues($mapMatrix, $arrayWalls);
- $routes++;
- //Remove low valued wall;
- $lowvaluewall = true;
- $nullwalls = 0;
- foreach ($walllist as $nwallposition => $wallvalue) {
- if ($wallvalue == 0 OR ($lowvaluewall == true AND $wallvalue == 1))
- {
- $nloc = explode(",", $nwallposition);
- $x=$nloc[0];
- $y=$nloc[1];
- if ($x == $bestx AND $y == $besty)
- continue;
- $mapMatrix[$x][$y] = 'o';
- unset($arrayWalls[$x][$y]);
- $wallcount--;
- echo "RM($x, $y)";
-
- $nullwalls++;
- if ($nullwalls >= 2) {
- break;
- }
- if ($lowvaluewall == true AND $wallvalue == 1) {
- $lowvaluewall = false;
- }
- }
- }
- }
-
- //Refresh walls if we hit the wall count limit, once.
- if($wallcount >= $mapdata['walls'] && $lastRefresh == 0)
- {
- $lastRefresh = 1;
- $walllist = wallvalue($mapMatrix, "R");
- $routes++;
- foreach ($walllist as $nwallposition => $wallvalue) {
- if ($wallvalue <= 1) {
- $nloc = explode(",", $nwallposition);
- $i=$nloc[0];
- $j=$nloc[1];
- $mapMatrix[$i][$j] = 'o';
- unset($arrayWalls[$x][$y]);
- $wallcount--;
- echo "RM($x, $y)";
- }
- }
- echo "End Refresh walls to:[$wallcount]";
- }
-
- //If all walls are placed even after refresh, we're done
- if ($wallcount >= $mapdata['walls']) {
- echo "END;($wallcount) <b>Solution routed the path $routes times.</b>";
- break;
- }
- } while ($done == false);
-
- //echo "print";
- //print_r(wallvalue($mapMatrix, "R"));
- //echo "endprint";
- return $mapMatrix;
-}
-
-
-//Returns the essential 'move value' of individual walls in an array.
-function wallValues($mapMatrix, $arrayWalls) {
- $curpath = routePath($mapMatrix);
- $curmoves = $curpath['moves'];
- if ($curpath['blocked'])
- $curmoves = 0;
- //Prepare to return an array.
- $r = Array();
- foreach ($arrayWalls as $x => $a) {
- foreach ($a as $y => $v) {
- //echo "{O".$mapMatrix[$x][$y]."O}";
- if ($mapMatrix[$x][$y] <> 'R') {
- continue;
- }
- //Imagine the maze without the wall.
- $mapMatrix[$x][$y] = 'o';
- $newpath = routePath($mapMatrix);
- $newmoves = $newpath['moves'];
- //Great; so the value of that wall is:
- $r["$x,$y"] = $curmoves - $newmoves;
- //Okay, you can have your wall back.
- $mapMatrix[$x][$y] = 'R';
- }
- }
- return $r;
-}
-
-
-//Returns the essential 'move value' of a wall.
-function wallvalue($mapMatrix, $wall) {
- $curpath = routePath($mapMatrix);
- $curmoves = $curpath['moves'];
- for( $i = 1; $i <= $mapMatrix[0][1]; $i++) { //Number of Rows
- for( $j = 0; $j < $mapMatrix[0][0]; $j++) { //Number of Columns
- if ($mapMatrix[$i][$j] == $wall) {
- $mapMatrix[$i][$j] = 'o';
- $newpath = routePath($mapMatrix);
- $mapMatrix[$i][$j] = 'r';
- $newmoves = $newpath['moves'];
-
- $r["$i,$j"] = $curmoves - $newmoves;
-
- }
- }
- }
- return $r;
-}
-
-
-
-
-
-echo "<br >Path: ";
-echo $bla['moves'];
-echo "<br >";
-$mapdisplay = DisplayMap($map);
-$code = GenerateMapCode($map);
-
-
-echo "<br />$mapdisplay";
-echo "<br />$code";
-print_r ($map);
-
-echo "<br />";
-echo "<br />";
-echo "<br />";
-echo weight(1,2,3,4,5,6);
-echo "<br />";
-echo weight(1,2,3,4,5,6);
-echo "<br />";
-echo weight(1,2,3,4,5,6);
-echo "<br />";
-echo weight(1,2,3,4,5,6);
-echo "<br />";
-echo weight(1,2,3,4,5,6);
-echo "<br />";
-echo weight(1,2,3,4,5,6);
-
-
-
-
-
-?>
-</body>
-</html>