diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2013-01-25 00:26:07 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2013-01-25 00:26:07 -0800 |
commit | ae5c6c5800f39ef169986e59e69b43241ccf3902 (patch) | |
tree | b8428e9376c767176dee427855664fbf6102ca1f | |
parent | 54aac45cafb3df1bd1e31177d4f38750f495e908 (diff) | |
download | pathery-ae5c6c5800f39ef169986e59e69b43241ccf3902.tar.xz |
Added missing files, deleted some old files.
-rw-r--r-- | css/profile.css | 56 | ||||
-rw-r--r-- | images/OverlayTiles.xcf | bin | 63856 -> 66385 bytes | |||
-rw-r--r-- | images/Path1XRock.png | bin | 3162 -> 3262 bytes | |||
-rw-r--r-- | images/championpoints.png | bin | 1484 -> 1200 bytes | |||
-rw-r--r-- | pages/challengeOld.php | 362 | ||||
-rw-r--r-- | pages/gallery.php | 692 | ||||
-rw-r--r-- | pages/howtoplay.php | 127 | ||||
-rw-r--r-- | pages/test.php | 408 |
8 files changed, 56 insertions, 1589 deletions
diff --git a/css/profile.css b/css/profile.css new file mode 100644 index 0000000..3adf15e --- /dev/null +++ b/css/profile.css @@ -0,0 +1,56 @@ +
+
+@keyframes badgeAnimate
+{
+0% {transform: rotate(-90deg);}
+80% {transform: rotate(10deg);}
+95% {transform: rotate(-4deg);}
+97% {transform: rotate(1deg);}
+99% {transform: rotate(-1deg);}
+100% {transform: rotate(0deg);}
+}
+@-moz-keyframes badgeAnimate /* Firefox */
+{
+0% {-moz-transform: rotate(-90deg);}
+80% {-moz-transform: rotate(10deg);}
+95% {-moz-transform: rotate(-4deg);}
+97% {-moz-transform: rotate(1deg);}
+99% {-moz-transform: rotate(-1deg);}
+100% {-moz-transform: rotate(0deg);}
+}
+@-o-keyframes badgeAnimate /* Opera */
+{
+0% {-o-transform: rotate(-90deg);}
+80% {-o-transform: rotate(10deg);}
+95% {-o-transform: rotate(-4deg);}
+97% {-o-transform: rotate(1deg);}
+99% {-o-transform: rotate(-1deg);}
+100% {-o-transform: rotate(0deg);}
+}
+@-webkit-keyframes badgeAnimate /* Safari and Chrome */
+{
+0% {-webkit-transform: rotate(-90deg);}
+90% {-webkit-transform: rotate(8deg);}
+95% {-webkit-transform: rotate(-4deg);}
+97% {-webkit-transform: rotate(1deg);}
+99% {-webkit-transform: rotate(-1deg);}
+100% {-webkit-transform: rotate(0deg);}
+}
+
+.badge
+{
+ animation: badgeAnimate 1s linear;
+ -moz-animation: badgeAnimate 1s linear; /* Firefox */
+ -o-animation: badgeAnimate 1s linear; /* Opera */
+ -webkit-animation: badgeAnimate 1s linear; /* Safari and Chrome */
+
+ width:45px;
+ height:45px;
+ background-color: #666666;
+ background-size:100%;
+ padding: 1px 1px;
+ border-radius: 5px;
+ text-decoration: none;
+ border: 2px solid #888;
+ box-shadow: 0 0 3px #445;
+}
\ No newline at end of file diff --git a/images/OverlayTiles.xcf b/images/OverlayTiles.xcf Binary files differindex 76bfa09..6bf610c 100644 --- a/images/OverlayTiles.xcf +++ b/images/OverlayTiles.xcf diff --git a/images/Path1XRock.png b/images/Path1XRock.png Binary files differindex e64fcbb..dc21408 100644 --- a/images/Path1XRock.png +++ b/images/Path1XRock.png diff --git a/images/championpoints.png b/images/championpoints.png Binary files differindex f6625fe..ae5354f 100644 --- a/images/championpoints.png +++ b/images/championpoints.png diff --git a/pages/challengeOld.php b/pages/challengeOld.php deleted file mode 100644 index afb8741..0000000 --- a/pages/challengeOld.php +++ /dev/null @@ -1,362 +0,0 @@ -<?php -htmlHeader(array('tutorial'), 'Pathery Challenges', 'Challenges', array('scores')); -?> - -<body> - -<?php -topbar($Links); -?> - -<script src="sounds/script/soundmanager.js"></script> - -<script> -isChallenge = true; - - -function challengeLoad() {} - - -challenge1 = new Object(); -challenge2 = new Object(); -challenge3 = new Object(); -challenge4 = new Object(); -challenge5 = new Object(); - - -challenge1.start = "Welcome to Advanced Training #1. Help for these puzzles will be limited.<br /><i>Goal: 32</i> or more."; -challenge1.help = "If that was wrong, then try the right.<br /><i>Goal: 32</i> or more."; -challenge1.complete = "Great, I hope we discovered some things about the pathing.<br/>Press <b>Next</b>"; - -challenge2.start = "Round 2! What does it do when there's 2 outs?<br><i>Goal: 22</i> or more."; -challenge2.complete = "Yup, you can just block things off when there's more than one. This holds true for checkpoints too.<br/>Press <b>Next</b>"; -challenge2.help = "This might be something you didn't know you could do<br /><i>Goal: 22</i> or more."; - -challenge3.start = "Round 3! We're really getting to know that clock-wise path-priority thing aren't we.<br><i>Goal: 39</i> or more."; -//challenge3.complete = "What did you decide to do with that 4th wall? <br/>Press <b>Next</b>"; -challenge3.complete = "I wonder what you decided to do with that 4th wall... That's it for now. Go play the game! (press home)"; -challenge3.bonus = "Bonus Level unlocked. 'cMeInDtDeLrE'<br/>Press <b>Next</b>"; -challenge3.help = "I believe in this case, less is more.<br><i>Goal: 39</i> or more."; - -challenge4.start = "Teleports are traps you can use to your advantage. See if you can use the teleport to reach 33 moves!<br>Press <b>Go!</b>"; -challenge4.complete = "Well done!<br>Teleports add extra intrigue to the game."; -challenge4.help = "Let's use that teleport to block the way to the <i>A</i>!<br>We can make the path take longer to get to <i>A</i> in the process."; - -challenge5.start = "Now for a difficult one. The goal for this one is 75 moves.<br>Press <b>Go!</b> to check your path."; -challenge5.complete = "Look at you, so pro.<br><a href='home'>Go play the game!</a>"; -challenge5.help = "Try placing the walls as highlighted."; - -function challengeGo(mapid) { - var moves = mapjson[mapid].moves; - var tiles; - - switch (mapid) { - case '1': - if (moves >= 32) { - updateDsp(1, 'instructions', challenge1.complete); - tv.unlock(2); - } else { - updateDsp(1, 'instructions', challenge1.help); - } - break; - - case '2': - if (moves >= 22) { - updateDsp(1, 'instructions', challenge2.complete); - tv.unlock(3); - } else { - updateDsp(1, 'instructions', challenge2.help); - //var tiles = ["2,3,5","2,4,6"]; - //markTiles(tiles); - } - break; - - case '3': - if (moves >=39) { - updateDsp(1, 'instructions', challenge3.complete); - tv.unlock(4); - } else { - updateDsp(1, 'instructions', challenge3.help); - } - break; - - case '4': - if (moves >= 33) { - updateDsp(1, 'instructions', challenge4.complete); - tv.unlock(5); - } else { - updateDsp(1, 'instructions', challenge4.help); - tiles = ["4,1,5","4,2,6","4,3,7","4,4,9"]; - markTiles(tiles); - } - break; - - case '5': - if (moves >= 75) { - updateDsp(1, 'instructions', challenge5.complete); - //Unlock next button. - } else { - updateDsp(1, 'instructions', challenge5.help); - tiles = ["5,1,5","5,2,6","5,3,3","5,4,2","5,3,1"]; - markTiles(tiles); - } - break; - - } -} - - - -function markTiles(tiles) { - for(var i in tiles) { - var tmp = tiles[i]; - setTimeout('document.getElementById("'+tiles[i]+'").style.backgroundColor = "#ccccdd"', i*150 + 900); - } -} - -//TODO: -function challengeWall(mapid) { - //Disable function - return; - //Required walls: - var reqwall = new Array(); - reqwall[0] = "3,5."; - reqwall[1] = "4,6."; - - for(var i in reqwall) { - if (solution[mapid].indexOf(reqwall[i]) == -1) { - //Failed - return; - } - } - updateDsp(1, 'instructions', challenge2.wallstext) -} -function highlightElement(Eid) { -} - - -function startChallenge(mapid) { - //console.log("start challenge", mapid); - switch (mapid) { - case 1: - updateDsp(1, 'instructions', challenge1.start); - var goBtn = document.getElementById('1,btn'); - var interval1 = setInterval(function() { - goBtn.className += ' flash'; - }, 1200), - interval2; - setTimeout(function() { - interval2 = setInterval(function() { - goBtn.className = goBtn.className.replace(' flash', ''); - }, 1200); - }, 600); - var prevHandler = goBtn.onclick; - goBtn.onclick = function() { - clearInterval(interval1); - clearInterval(interval2); - goBtn.className = goBtn.className.replace(' flash', ''); - prevHandler.apply(this, arguments); - } - break; - case 2: - updateDsp(1, 'instructions', challenge2.start); - break; - case 3: - updateDsp(1, 'instructions', challenge3.start); - break; - case 4: - updateDsp(1, 'instructions', challenge4.start); - break; - case 5: - updateDsp(1, 'instructions', challenge5.start); - break; - } -} - -function TutorialView(low, high) { - this.low = low; - this.high = high; - this.cur = low; - //Lock them all. - this.locked = low; - - //Override hack to unlock all the levels. - //this.locked = high; - - this.nextbtn = document.getElementById('nextbtn'); - this.prevbtn = document.getElementById('prevbtn'); - this.interval1 = this.interval2 = null; -} -TutorialView.prototype.showTutorial = function(num) { - for (var i = this.low; i <= this.high; i++) { - var elem = document.getElementById("tut-" + i); - if (elem.className.indexOf('hidden') < 0) - elem.className += 'hidden'; - } - elem = document.getElementById("tut-" + num); - elem.className = elem.className.replace('hidden', ''); - //Is the map after this disabled? - this.nextbtn.className = this.nextbtn.className.replace(' disabled', ''); - if (this.locked <= this.cur) - this.nextbtn.className += ' disabled'; - startChallenge(num); - tv.nextbtn.className = tv.nextbtn.className.replace(' flash', ''); -} -TutorialView.prototype.next = function() { - clearInterval(this.interval1); - clearInterval(this.interval2); - if (this.nextbtn.className.indexOf(' disabled') > -1) - return; - this.showTutorial(++this.cur); - if (this.cur == this.high) { - if (this.nextbtn.className.indexOf('hidden') < 0) - this.nextbtn.className += ' hidden'; - } else { - this.nextbtn.className = this.nextbtn.className.replace(' hidden', ''); - //this.nextbtn.className += ' disabled'; - } - this.prevbtn.className = this.prevbtn.className.replace(' hidden', ''); -} -TutorialView.prototype.prev = function() { - this.showTutorial(--this.cur); - if (this.cur == this.low) { - if (this.prevbtn.className.indexOf('hidden') < 0) - this.prevbtn.className += ' hidden'; - } else - this.prevbtn.className = this.prevbtn.className.replace(' hidden', ''); - this.nextbtn.className = this.nextbtn.className.replace(' hidden', ''); -} -TutorialView.prototype.unlock = function(n) { - if (n > this.locked) { - this.locked = n; - if (this.locked >= this.cur) { - this.nextbtn.className = this.nextbtn.className.replace(' disabled', ''); - this.interval1 = setInterval(function() { - tv.nextbtn.className += ' flash'; - }, 1200); - setTimeout(function() { - tv.interval2 = setInterval(function() { - tv.nextbtn.className = tv.nextbtn.className.replace(' flash', ''); - }, 1200); - }, 600); - } - } - - -} -</script> - -<?php -include('./includes/maps.php'); -//include('./includes/datas.php'); - -//Page Load; -//STAGE 1: -//Intro and Instructions; press go! -//Lightup; Go-button. - -//Go is done animating and GOAL is unachieved. -//STAGE 2: -//Show where walls go, and/or encourage them. -//Lightup; Wall Spots - -//All walls have been placed correctly. -//STAGE 3: -//'That looks good, try pressing Go!' -//Lightup; Go-Button - -//Go is done animating, and goal is achieved: -//STAGE 4: -//Horray! Move on to next - highlight 'Next' -//Lightup; Next-Button - -?> -<div id="tut-wrapper"> - <div style='height:80px;' id='1,instructions'> - Welcome to Advanced Training #1. Help for these puzzles will be limited.<br /><i>Goal: 32</i> or more. - </div> -<? - -//Prepare maps. -$example1[] = "ootooooooooo"; -$example1[] = "oofooooooooo"; -$example1[] = "oooooooooooo"; -$example1[] = "oooooooooooo"; -$example1[] = "oooooooousoo"; - -$myparams['teleports'] = 1; -$myparams['walls'] = 5; -$map1 = GenerateShapedMap($example1, $myparams); - -$challenge2[] = "oooooooou"; -$challenge2[] = "ooooooooo"; -$challenge2[] = "ooooooooo"; -$challenge2[] = "oroooooos"; -$challenge2[] = "ooroooooo"; -$challenge2[] = "ftoooooou"; -$myparams['checkpoints'] = 1; -$myparams['teleports'] = 1; -$myparams['walls'] = 2; -$map2 = GenerateShapedMap($challenge2, $myparams); - -$challenge3[] = "otoooooooooan"; -$challenge3[] = "ooooooooooooo"; -$challenge3[] = "ooooooooooooo"; -$challenge3[] = "ooooooooooooo"; -$challenge3[] = "osuofoooooomo"; - -$myparams['checkpoints'] = 2; -$myparams['teleports'] = 0; -$myparams['walls'] = 4; -$map3 = GenerateShapedMap($challenge3, $myparams); - -$challenge4[] = "suooooaooof"; -$challenge4[] = "sooooooooof"; -$challenge4[] = "sooooooooof"; -$challenge4[] = "sooooooorof"; -$challenge4[] = "soooooootof"; -$myparams['checkpoints'] = 1; -$myparams['teleports'] = 1; -$myparams['walls'] = 4; -$map4 = GenerateShapedMap($challenge4, $myparams); - -$challenge5[] = "soooaobtorf"; -$challenge5[] = "soocrooooof"; -$challenge5[] = "souooooooof"; -$challenge5[] = "sooooooooof"; -$challenge5[] = "sooooooooof"; -$myparams['checkpoints'] = 3; -$myparams['teleports'] = 1; -$myparams['walls'] = 5; -$map5 = GenerateShapedMap($challenge5, $myparams); - -//Display maps. -echo '<div id="tut-1" class="hidden">'; -echo DisplayMap($map1, 1, 'puzzle'); -echo '</div><div id="tut-2" class="hidden">'; -echo DisplayMap($map2, 2, 'puzzle'); -echo '</div><div id="tut-3" class="hidden">'; -echo DisplayMap($map3, 3, 'puzzle'); -echo '</div><div id="tut-4" class="hidden">'; -echo DisplayMap($map4, 4, 'puzzle'); -echo '</div><div id="tut-5" class="hidden">'; -echo DisplayMap($map5, 5, 'puzzle'); -echo '</div>'; - -?> - - <div class="wrapper"> - <a href="javascript:tv.next()" id="nextbtn" class="next disabled">Next</a> - <a href="javascript:tv.prev()" id="prevbtn" class="next hidden">Previous</a> - </div> -</div> - -<script> -var tv = new TutorialView(1, 3); -tv.showTutorial(1); -soundManagerInit(); -</script> - -<?php -htmlFooter(array('tutorial')); -?> 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> diff --git a/pages/howtoplay.php b/pages/howtoplay.php deleted file mode 100644 index 8c9f2f5..0000000 --- a/pages/howtoplay.php +++ /dev/null @@ -1,127 +0,0 @@ -<?php -htmlHeader(array('tutorial')); -?> - -<body> -<?php -topbar($Links); - -include('./includes/maps.php'); - -// function GenerateMap($rows, $cols, $rockchance, $numBlocks = -1, $cp = -1, $tp = -1) { -//$map = GenerateMap(6, 3, 1000, 3, 5, 0); -//$mapcode = GenerateMapCode($map); - -//echo "$mapcode <br />"; -//echo displaymap($map, 0, true); - -//Demo nothing. -$basicmapcode = '6x3.c0.r0.w9.t0.:0s.4f.0s.4f.0s.4f.'; -$basicmap = displaymap(GenerateMapByCode($basicmapcode), 1, 'example'); - -//Map Demoing the checkpoints -$cpcode = "6x3.c5.r0.w9.t0.:0s.0a.2b.0f.0s.1e.2f.0s.0d.2c.0f."; -$cpmap = displaymap(GenerateMapByCode($cpcode), 2, 'example'); - -//Map Demoing the teleports -$tpcode = "6x3.c0.r0.w5.t4.:0s.0n.2t.0f.0s.4f.0s.0u.2m.0f."; -$tpmap = displaymap(GenerateMapByCode($tpcode), 3, 'example'); - -?> - -<div class="wrapper"> - -<div id="tut-0" class="hidden"> - <h1 style="margin-bottom: 0">Tutorial</h1> - <p> - <br />The object of the game is to make the longest maze. - <br />The "Snake" (name pending) must go to all the checkpoints. - <br />It starts from the start squares: - <table><tr><td class='grid_td_start'></td></tr></table> - and goes to the end squares: - <table><tr><td class='grid_td_finish'></td></tr></table> - <br />Build a maze by clicking to place blocks. You can remove a block by clicking it again. - <br />It must be able to make it through your maze, so no walling completely! - </p> - <p>Try it: - <? echo $basicmap; ?> - </p> - <br /> - <a href="javascript:showTutorial(1)" class="next">Next</a> -</div> - -<div id="tut-1" class="hidden"> - <h2>Checkpoints:</h2> - <table> - <tr> - <td class='grid_td_cpa'></td> - <td class='grid_td_cpb'></td> - <td class='grid_td_cpc'></td> - <td class='grid_td_cpd'></td> - <td class='grid_td_cpe'></td> - </tr> - </table> - <p> - The path must reach all these (if they exist) before going to finish. Try it: - <? echo $cpmap; ?> - </p> - <br /><br /> - <p> - Tip: - Try to combine odd-letters with each other; - <br />I.E. If A, B, C exist, try to make a box around A and C, then maze the entrance to the box. - <br />This way, the path enters the box for A, leaves for B, returns for C, and leaves for the exit. - This would make the path go through your maze 4 times! - </p> - <a href="javascript:showTutorial(2)" class="next">Next</a> - <a href="javascript:showTutorial(0)" class="next">Back</a> -</div> - -<div id="tut-2" class="hidden"> - <h2>Teleports:</h2> - <table class="padded"> - <tr> - <td>Teleport 1:</td> - <td class='grid_td_tp1_in' ></td> - <td class='grid_td_tp1_out' ></td> - </tr> - <tr> - <td>Teleport 2:</td> - <td class='grid_td_tp2_in' ></td> - <td class='grid_td_tp2_out' ></td> - </tr> - </table> - <p> - <br />Teleport tiles are traps. When the path goes across the "IN" tile, it gets thrown to the "OUT" tile. - <br />The path will not avoid teleports. Check this example out: - <div style='width:200px;'> - <? echo $tpmap; ?> - </div> - <br /> - <br /> - Implementing a teleport into your maze can have a big impact. - </p> - - <br /><p>That should be enough information to get you started. - <br />Now <a href='home'>go try it out!</a> - </p> - <a href="javascript:showTutorial(1)" class="next">Back</a> -</div> - -</div> - -<script> -function showTutorial(num) { - for (var i = 0; i < 3; i++) { - var elem = document.getElementById("tut-" + i); - if (elem.className.indexOf('hidden') < 0) - elem.className += 'hidden'; - } - elem = document.getElementById("tut-" + num); - elem.className = elem.className.replace('hidden', ''); -} -showTutorial(0); -</script> - -<?php -htmlFooter(); -?> diff --git a/pages/test.php b/pages/test.php deleted file mode 100644 index a5fe882..0000000 --- a/pages/test.php +++ /dev/null @@ -1,408 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<!-- iso-8859-1 -->
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <link href="css/mapstyles.css" rel="stylesheet" type="text/css" />
- <title>Maze TowerD</title>
-
-<?PHP
-// <script src="js/mapspecs.js" type="text/javascript"></script>
-
-include('../mazetd/includes/maps.php');
-
-//$mygrid = GenerateMap(20, 8, 4, 3);
-if (isset($_GET[mapcode])) {
- $mygrid = GenerateMapByCode($_GET[mapcode]);
-} else {
- $mygrid = GenerateMap(12, 12, 8);
- $mygrid2 = GenerateMap(rand(12, 18), rand(10, 14), 8);
- //$mygrid = GenerateMap(23, 13, 7, 3);
-}
-$code = GenerateMapCode($mygrid);
-
-
-?>
-
- <script src="js/ajax.js" type="text/javascript"></script>
-
-<script type="text/javascript">
-window.onload = function(){
- document.getElementById('blocksdisplay').innerHTML = "<b>"+blocks+"</b>";
- //doSend();
-}
-
-
-var solution = new Array();
-var blocks = new Array();
-var count = new Array();
-var mapdata = new Array();
-
-function grid_click(obj) {
-
- //Prepare data
- tmp = obj.id.split(',');
- mapid = tmp[0] - 0;
- y = tmp[1];
- x = tmp[2];
-
- if (solution[mapid] == undefined) {
- getmapdata(mapid);
- }
-
- if (obj.cv) {
- obj.cv = false;
-
- //obj.style.backgroundColor = '#ffffff';
- obj.setAttribute("class", "grid_td");
- blocks[mapid]++;
- //alert(obj.id);
- //Remove wall
- solution[mapid] = solution[mapid].replace(y+','+x+'.', '');
- } else {
- if (blocks[mapid] < 1) {
- alert("Outa blocks!");
- return;
- }
- obj.cv = true;
- //obj.style.backgroundColor = '#ff0000';
- obj.setAttribute("class", "grid_td_walls");
- //Add Wall
- solution[mapid] += y+','+x+'.';
- blocks[mapid]--;
- }
- document.getElementById('blocksdisplay').innerHTML = "<b>"+blocks[mapid]+"</b>";
-
- document.getElementById(mapid+',dsptr').innerHTML = " "+blocks[mapid]+" walls remain.";
-
-}
-
-function getmapdata(mapid) {
- mapdata[mapid] = JSON.parse(document.getElementById(mapid+',mapdata').innerHTML);
- blocks[mapid] = mapdata[mapid].walls;
- solution[mapid] = '.';
- document.getElementById(mapid+',dsptr').innerHTML = " "+blocks[mapid]+" walls remain.";
- //document.getElementById(mapid+',dsptr').innerHTML = blocks[mapid];
-}
-
-//==needs mapid
-function doSend(mapid) {
- //mapcode = document.getElementById('mapcode').innerHTML;
- //alert("dosend..");
- //mapid = 1;
- if (solution[mapid] == undefined) {
- getmapdata(mapid);
- }
-
- mapcode = '<? echo $code; ?>';
- reqstr = "";
- reqstr += "&mapcode="+mapdata[mapid].code;
- reqstr += "&mapid="+mapid;
- //alert (mapdata[mapid].code);
- reqstr += "&solution="+solution[mapid];
-
- //alert(reqstr);
- document.getElementById('dispdo').innerHTML = "http://mazetd.4xg.net/do.php?r=getpath"+reqstr
-
- //alert("request string:"+reqstr);
- ajax.requestFile = "do.php?r=getpath"+reqstr; //prepare strdata
- ajax.onCompletion = request_path_done; // Specify function to be executed on response.
- ajax.runAJAX();// Do it!
-}
-function resetwalls(mapid) {
- answer = confirm("Remove walls and start fresh?");
- if (answer) {
- if (solution[mapid] == undefined) return;
- walls = solution[mapid].split('.');
- for(var i in walls) {
- //alert(walls[i]);
- tmp = walls[i].split(',');
- eid = mapid+','+tmp[0]+','+tmp[1];
- //alert('eid:'+eid);
- if (document.getElementById(eid) != undefined) {
- obj = document.getElementById(eid);
- obj.setAttribute("class", "grid_td");
- obj.cv = false;
- //alert("exe");
- }
- }
- solution[mapid] = undefined;
- getmapdata(mapid);
- }
-}
-
-function request_path_done() {
- //document.getElementById('mapdisplay').innerHTML = ajax.response;
- //alert ("resp: "+ajax.response);
- //if (ajax.response == undefined) return;
-
- //alert ("resp: "+ajax.response);
- var JO = JSON.parse(ajax.response);
-
- for(var i in JO.error) {
- alert('\n JO error ' + JO.error[i]);
- }
-
- //document.getElementById('disp').innerHTML = JO.map;
-
- if (JO.blocked) {
- alert("Path is blocked make sure there is a way for it to go!");
- return;
- }
- //document.write(JO.map);
- //alert ("moves: "+JO.moves);
- //alert ("path: "+JO.start);
- document.getElementById('disppath').innerHTML = JO.path;
- document.getElementById('disptotalmoves').innerHTML = JO.moves;
-
- AnimatePath(JO.path, JO.mapid, JO.start);
-
- //document.getElementById('mapdisplay').innerHTML = JO.map;
-
-}
-
-
-//This needs a start location.
-function AnimatePath(path, mapid, start) {
- tmp = start.split(',');
- y = tmp[0];
- x = tmp[1];
-
- p = path;
- //alert("Begin");
- t = p.length;
- //count[mapid] = 0;
- doanimate(x, y, p, t, mapid);
- //setTimeout("doanimate("+x+","+y+",'"+p+"',"+t+")",500);
-}
-
-var snake = new Array();
-
-function doanimate(x, y, p, t, mapid) {
- //Animate current square, and move to next one.
- if (count[mapid] == undefined) {
- count[mapid] = 0;
- }
- //alert("test");
- if (snake[mapid] == undefined) {
- snake[mapid] = new Array();
- snake[mapid]['color'] = '#4444bb';
- }
-
- //==
- // document.getElementById('1count').innerHTML = count[mapid];
- document.getElementById(mapid+',dspbr').innerHTML = count[mapid]+ " moves";
-
- eid = mapid+','+x+','+y;
-
- //Verify.
- if (document.getElementById(eid) == undefined) {
- alert("Path exited field..?");
- return;
- }
- handle = document.getElementById(eid);
-
- //Maintain our original classname, no matter the cost!
- origclass = handle.className;
- if ( origclass == 'grid_td_path1' ||
- origclass == 'grid_td_path2' ||
- origclass == 'grid_td_path3' ||
- origclass == 'grid_td_path4' ||
- origclass == 'grid_td_animate_pre' ) {
- // if (origclass == 'grid_td_animate' || origclass == 'grid_td_animate_pre' ) {
- origclass = handle.classOrigName;
- //setTimeout(handle.setAttribute('class', origclass), 850);
- //alert('ex ' + origclass);
- }
- //handle.style.backgroundColor = snake[mapid]['color'];
- handle.classOrigName = origclass;
-
-
- //Just moves
- switch(t) {
- case '1': //1 - Up
- case '2': //2 - Right
- case '3': //3 - Down
- case '4': //4 - Left
- count[mapid]++;
- handle.setAttribute('class', 'grid_td_path'+t);
- break;
- }
- handle.style.backgroundColor = snake[mapid]['color'];
-
- //setTimeout(handle.setAttribute('class', origclass), 850);
- setTimeout("document.getElementById('"+eid+"').setAttribute('class', '"+origclass+"')", 855);
- setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '';", 855);
-
- //Okay lets make it look cool now.
- //document.getElementById(handle).setAttribute('class', 'grid_td_animate_pre');
- //Needs a delay, or simply wont work.
- //setTimeout("document.getElementById('"+handle+"').setAttribute('class', 'grid_td_animate')", 55);
-
- //document.getElementById('blocksdisplay').innerHTML = "<b>"+origclass+"</b>";
-
- //if (origclass != 'grid_td_animate' && origclass != 'grid_td_animate_pre' ) {
- //document.getElementById('blocksdisplay').innerHTML = "<b>"+origclass+"</b>";
- // setTimeout("document.getElementById('"+handle+"').setAttribute('class', '"+origclass+"')", 850);
- //} else {
- //document.getElementById('blocksdisplay').innerHTML = "<b>HELLO WORLD!?</b>";
- //}
-
- //Moving on:
- speed = 85;
- t = p.substring(0, 1);
- if (t == '') {
- count[mapid] = 0;
- snake[mapid]['color'] = '#4444bb';
- return;
- }
- switch(t) {
- case '1': x--; break; //1 - Up
- case '2': y++; break; //2 - Right
- case '3': x++; break; //3 - Down
- case '4': y--; break; //4 - Left
- //Special codes.
- //Reached Target
- case 'a':
- speed = 800;
- snake[mapid]['color'] = '#F777FF';
- break;
- case 'b':
- speed = 800;
- snake[mapid]['color'] = '#FFFFAA';
- break;
- case 'c':
- speed = 800;
- snake[mapid]['color'] = '#44EE66';
- break;
- case 'd':
- speed = 800;
- snake[mapid]['color'] = '#ff9911';
- break;
- case 'e':
- speed = 800;
- snake[mapid]['color'] = '#44ddee';
- break;
- case 'f':
- speed = 800;
- snake[mapid]['color'] = '#4444bb';
- break;
- //The mighty teleport.
- case 'u':
- //alert(p);
- tmp = p.split('u');
- //alert(tmp[1]);
- //alert(tmp[2]);
- AnimatePath(tmp[2], mapid, tmp[1]);
- //setTimeout("doanimate("+x+","+y+",'"+p+"','"+t+"','"+mapid+"')",speed);
- return;
- speed = 800;
- break;
- case 'n':
- //alert(p);
- tmp = p.split('n');
- //alert(tmp[1]);
- //alert(tmp[2]);
- AnimatePath(tmp[2], mapid, tmp[1]);
- //setTimeout("doanimate("+x+","+y+",'"+p+"','"+t+"','"+mapid+"')",speed);
- return;
- speed = 800;
- break;
- }
- //Remove move from p
- p = p.substring(1);
- //speed = (10 * p.length) + 40;
-
- setTimeout("doanimate("+x+","+y+",'"+p+"','"+t+"','"+mapid+"')",speed);
-}
-var de = false;
-function displaymap(obj) {
- if (de == false) {
- obj.setAttribute('class', 'mapdisplay_up');
- }
-}
-function minmap(obj) {
- de = true;
- obj.setAttribute('class', 'mapdisplay');
- setTimeout("de = false;", 1000);
-}
-
-</script>
-</head>
-
-<body>
-<?php
-
-
-echo DisplayMap($mygrid, 1);
-echo DisplayMap($mygrid2, 2);
-
-//Echo Findpath ($mygrid);
-$start[0] = 0;
-$start[1] = 1;
-
-//$p = Findpath ($mygrid, $start, 'a');
-//$pathmap1 = $p['path'];
-
-//echo "<br />BP1:".$p['path']."<br />";
-//echo "<br />yx2:".$p['end']."<br />";
-
-//$p = Findpath ($mygrid, explode(",", $p['end']), 'b');
-//echo "<br />BP:".$p['path']."<br />";
-//echo "<br />yx:".$p['end']."<br />";
-// $pathmap1 .= $p['path'];
-
-// $p = Findpath ($mygrid, explode(",", $p['end']), 'c');
-// $pathmap1 .= $p['path'];
-
-$p = Findpath ($mygrid, "2,4.3,4", 'f');
-$pathmap1 .= $p['path'];
-
-//echo DisplayMap($pathmap);
-
-//==Needs to contain mapid.
-//echo "<br /> <b><a href='javascript:doSend()'>Attempt Solution laaaaaaaaaaaaa laaaaaaaaaaaa CLick on this..</a></b>";
-echo "<br /><div style='font-size:32pt;' id='1count'><b>b</b></div> ";
-echo "<br />";
-var_dump ($p);
-
-
-echo "<br />";
-
- // $time = microtime();
- // $time = explode(' ', $time);
- // $time = $time[1] + $time[0];
- // $begintime = $time;
-
- //for($i = 1; $i <= 500; $i++) {
- //$mygrid = generateMap(13, 8, 4, 3);
- //echo "$i <br />";
- // $pathmap = Findpath ($mygrid, $start, 'a');
- // $pathmap = Findpath ($mygrid, $start, 'b');
- // $pathmap = Findpath ($mygrid, $start, 'c');
- // $pathmap = Findpath ($mygrid, $start, 'f');
- //}
- // $time = microtime();
- // $time = explode(" ", $time);
- // $time = $time[1] + $time[0];
- // $endtime = $time;
- // $totaltime = round($endtime - $begintime, 5);
- // echo "<br /><b>500 paths executed in: $totaltime s</b>";
-
- //Starting result:
- //500 paths executed in: 5.24884 s
- //On a $mygrid = GenerateMap(13, 8, 4, 3); board.
- //Now 1.
-echo "Mapcode: $code";
-?>
-<div id="blocksdisplay"><b>b</b></div>
-
-<div id="disp"><b></b></div>
-<div id="disppath"><b></b></div>
-<br />
-<div id="dispdo"><b></b></div>
-<br />
-<div id="disptotalmoves"><b></b></div>
-</body>
-</html>
\ No newline at end of file |