Alien Sequence v1.1 Source
steve@slayeroffice.com
<style type="text/css">
#light { position:absolute;width:20px;height:20px;cursor:hand;font-family:arial;font-size:8pt;}
#mContainer {position:absolute;top:0px;left:0px;width:284px;height:269px;background-image:url('bg.jpg');background-repeat:no-repeat;}
#msg {position:absolute;top:70px;left:105px;width:140px;height:32px;border-style:solid;border-width:1px;border-color:#9AAEA2;background-color:#000000;color:#9AAEA2;font-family:arial;font-size:8pt;padding:10px;text-align:center;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100);}
#controls {position:absolute;top:10px;left:290px;width:175px;border-style:solid;border-width:1px;background-color:#000000;color:#9AAEA2;border-color:#9AAEA2;padding:5px;display:none;}
.btn {border-style:solid;border-width:1px;color:#000000;background-color:#9AAEA2;font-family:arial;font-size:7.5pt;width:95px;cursor:hand;}
#credits {position:absolute;top:280px;left:10px;width:284px;}
#helper {position:absolute;top:170px;left:290px;width:175px;border-style:solid;border-width:1px;background-color:#000000;color:#9AAEA2;border-color:#9AAEA2;padding:5px;font-family:arial;display:none;}
</style>
<script language="javascript">
xDoc = document.getElementById;
zDoc = document.all;
document.title = "slayer.office | Alien Sequence"
if(navigator.userAgent.indexOf('MSIE')==-1)alert("This game requires Internet Explorer 5.5 or higher.");
var level =0;
var xLevel = 0;
c = document.cookie;
if(c.indexOf('sq_lvl')==-1) {
document.cookie = "sq_lvl=0*;path=/;expires=Sun, 26-Jan-2050 00:00:00 GMT";
} else {
xStart = document.cookie.indexOf("sql_lvl=") +9;
xLevel = c.substring(xStart,(c.indexOf("*")-1));
level = parseInt(xLevel);
}
var diamond = new Image(); diamond.src = "diamond.gif";
var transparent = new Image(); transparent.src ="tp.gif";
var gameLevels = new Array();
gameLevels[0] = new Array(0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0);
gameLevels[1] = new Array(1,0,1,0,1,1,0,1,0,1,0,0,0,0,0,1,0,1,0,1,1,0,1,0,1);
gameLevels[2] = new Array(0,1,0,1,0,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,0,1,0,1,0);
gameLevels[3] = new Array(0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,1,1,1,0,1,1);
gameLevels[4] = new Array(1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,0,0,0,1,1,1,1,0,1,1);
gameLevels[5] = new Array(0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,1,0,1,1,1,0);
gameLevels[6] = new Array(1,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,1,1,1,0);
gameLevels[7] = new Array(0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0);
gameLevels[8] = new Array(0,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,0,1,1,1,1,1,0,0);
gameLevels[9] = new Array(0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0);
gameLevels[10] = new Array(1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,0,1,1,1,0);
gameLevels[11] = new Array(1,1,1,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,1,0,0,1,0,1,0);
gameLevels[12] = new Array(0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0);
gameLevels[13] = new Array(0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0);
gameLevels[14] = new Array(0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1);
gameLevels[15] = new Array(1,1,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,1,1,0,0,0,0,1);
gameLevels[16] = new Array(1,0,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1);
gameLevels[17] = new Array(0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,1,0,0,1,1,0,0);
gameLevels[18] = new Array(0,1,1,1,1,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,0,1,0,0);
gameLevels[19] = new Array(1,1,1,1,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,0,1,0,0,1);
gameLevels[20] = new Array(0,0,0,1,0,0,0,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,0,1,1);
gameLevels[21] = new Array(0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,1,0,1,0,0,1,0,1,0);
gameLevels[22] = new Array(0,0,1,1,0,0,1,0,0,1,1,0,1,1,1,1,1,1,1,1,0,1,0,0,1);
gameLevels[23] = new Array(0,1,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0);
gameLevels[24] = new Array(1,0,1,1,0,1,0,1,0,0,1,0,0,0,1,1,1,1,1,1,0,1,0,0,1);
gameLevels[25] = new Array(0,1,1,1,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,0,0,1,0,1,0);
gameLevels[26] = new Array(0,1,0,1,1,0,0,1,0,0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0);
gameLevels[27] = new Array(0,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,0,0,1,1,0,1,1,1,0);
gameLevels[28] = new Array(0,0,1,1,1,0,1,1,1,1,0,0,0,1,1,0,0,1,1,0,0,0,1,0,0);
gameLevels[29] = new Array(0,1,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,1,1,0,0,1,1,0,0);
gameLevels[30] = new Array(0,1,1,0,0,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0);
gameLevels[31] = new Array(0,1,1,1,1,0,1,0,1,0,0,1,0,0,1,1,1,0,1,0,1,0,0,0,0);
gameLevels[32] = new Array(0,1,0,1,0,0,0,1,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,0,0);
gameLevels[33] = new Array(0,1,1,0,0,0,1,0,0,1,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0);
gameLevels[34] = new Array(0,1,1,0,0,0,1,0,0,1,0,1,1,1,0,0,0,0,0,0,1,0,1,0,0);
gameLevels[35] = new Array(0,1,1,1,0,0,1,0,0,1,0,1,0,0,0,0,1,0,1,0,0,1,0,0,0);
gameLevels[36] = new Array(0,1,0,0,0,0,1,0,1,0,0,1,1,1,0,1,1,0,0,0,1,0,0,0,0);
gameLevels[37] = new Array(0,1,1,1,1,0,1,0,0,0,0,0,1,1,0,1,1,1,0,0,1,1,1,0,0);
gameLevels[38] = new Array(0,1,1,1,1,0,1,0,0,0,0,0,1,1,0,0,0,1,0,0,1,1,0,0,0);
gameLevels[39] = new Array(0,1,1,1,0,1,0,0,0,1,1,0,1,0,1,1,1,0,1,1,0,0,1,0,0);
var on_off = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
var moves=0;
var adjacent=new Array();
adjacent[0] = new Array(1,5);
adjacent[1] = new Array(0,2,6);
adjacent[2] = new Array(1,3,7);
adjacent[3] = new Array(2,4,8);
adjacent[4] = new Array(3,9);
adjacent[5] = new Array(0,6,10);
adjacent[6] = new Array(1,5,7,11);
adjacent[7] = new Array(2,6,8,12);
adjacent[8] = new Array(3,7,9,13);
adjacent[9] = new Array(4,8,14);
adjacent[10] = new Array(5,11,15);
adjacent[11] = new Array(6,10,12,16);
adjacent[12] = new Array(7,11,13,17);
adjacent[13] = new Array(8,12,14,18);
adjacent[14] = new Array(9,13,19);
adjacent[15] = new Array(10,16,20);
adjacent[16] = new Array(11,15,17,21);
adjacent[17] = new Array(12,16,18,22);
adjacent[18] = new Array(13,17,19,23);
adjacent[19] = new Array(14,18,24);
adjacent[20] = new Array(15,21);
adjacent[21] = new Array(16,20,22);
adjacent[22] = new Array(17,21,23);
adjacent[23] = new Array(18,22,24);
adjacent[24] = new Array(19,23);
var deg2radians = Math.PI * 2 / 360;
var doCookie = true;
function initPage() {
startX=102; startY=37;rowTrack=0;
mHTML="";
for(i=0;i<25;i++) {
mHTML+='<div disabled=1 id="light" style="top:' + startY + 'px;left:' + startX + 'px;" onClick="handleLightClick(' + i + ');"><img name="dImg" src="tp.gif"></div>';
rowTrack++;
startX+=30;
if(rowTrack>=5) {
rowTrack=0;
startX=102;
startY+=30;
}
}
xDoc("mContainer").innerHTML = mHTML;
}
function initLevel() {
zDoc.curSequenceTD.innerHTML = level+1 + ' of ' + gameLevels.length;
zDoc.curMovesTD.innerHTML="0";
zDoc.controls.style.display="block";
if(doCookie) {
document.cookie = "sq_lvl=" + level + "*;path=/;expires=Sun, 26-Jan-2050 00:00:00 GMT";
xLevel=level;
}
if(parseInt(xLevel)>0)zDoc.mPrev.style.display="block";
moves=0;
for(i=0;i<gameLevels[level].length;i++) {
zDoc.light[i].disabled=0;
gameLevels[level][i]?turnOn(i):turnOff(i);
}
}
function turnOn(mID) {
on_off[mID] = 1;
document.all.dImg[mID].src = diamond.src;
}
function turnOff(mID) {
on_off[mID] = 0;
document.all.dImg[mID].src = transparent.src;
}
function handleLightClick(lightID) {
moves++;
zDoc.curMovesTD.innerHTML= moves;
for(i=0;i<adjacent[lightID].length;i++)on_off[adjacent[lightID][i]]?turnOff(adjacent[lightID][i]):turnOn(adjacent[lightID][i]);
on_off[lightID]?turnOff(lightID):turnOn(lightID);
if(checkWin()) advanceLevel();
}
function checkWin() {
for(i=0;i<on_off.length;i++) if(on_off[i] == 1)return false;
return true;
}
function advanceLevel() {
level++;
if(level==gameLevels.length) {
zDoc.msg.innerHTML = "all seqeunces complete.<br>CONGRATULATIONS!";
zDoc.msg.style.display="block";
zDoc.msg.style.filter="alpha(opacity=100)";
} else {
zDoc.msg.style.pixelTop=80;
zDoc.msg.innerHTML = "sequence complete."
callFade(1,"msg");
}
}
// fade functions
op=0;
var fadeInterval,fadeOutInterval,toFade;
function callFade(dir,objName) {
if(dir){
op=5;
xDoc(objName).style.filter = "alpha(opacity=5)";
} else {
op=100;
xDoc(objName).style.filter = "alpha(opacity=100)";
}
zDoc[objName].style.display="block";
toFade = objName;
fadeInterval = setInterval("fade(" + dir + "," + objName + ")",10);
}
function fade(dir) {
if(dir) {
if(op<100) {
op+=5;
xDoc(toFade).style.filter="alpha(opacity="+op+")";
} else {
clearInterval(fadeInterval);
callFade(0,toFade);
}
} else {
if(op>0) {
op-=5;
xDoc(toFade).style.filter="alpha(opacity="+op+")";
} else {
clearInterval(fadeInterval);
zDoc[toFade].style.display="none";
if(level<parseInt(xLevel)) {
doCookie=false;
} else {
doCookie=true;
}
initLevel();
}
}
}
function showHelp() {
zDoc.helper.style.display="block";
}
function showPrev() {
mHTML="";
for(i=0;i<parseInt(xLevel);i++)mHTML+= "<a style='color:#9AAEA2;' href='javascript:level=" + i + ";callFade(0,\"msg\");'>Sequence " + (i+1) + "</a><br>"
mHTML+="<font size=1><input type=button value=cancel class=btn onClick=\"zDoc.msg.style.display='none';\">";
zDoc.msg.innerHTML = mHTML;
zDoc.msg.style.filter = "alpha(opacity=100)";
zDoc.msg.style.display="block";
zDoc.msg.style.zIndex=100;
}
</script>
<body onload="initPage();">
<div id="mContainer"></div>
<div id="msg"><center><font size=1>welcome to</font><br><b>alien sequence</b><br><input type="button" class="btn" value="begin" onclick="callFade(0,'msg');"></center></div>
<div id="controls">
<table width=100% cellpadding=2 cellspacing=0 border=0 style="color:#9AAEA2;font-family:arial;font-size:8pt;">
<tr><td>current sequence: </td><td id="curSequenceTD">1</td></tr>
<tr><td>current moves: </td><td id="curMovesTD">0</td></tr>
<tr><td colspan=2><hr noshade size=1 color=#9AAEA2></td></tr>
<tr><td colspan=2 align=center><input type="button" class="btn" value="restart sequence" onclick="initLevel();"></td></tr>
<tr><td colspan=2><hr noshade size=1 color=#9AAEA2></td></tr>
<tr><td colspan=2 align=center><input type="button" class="btn" value="how to play" onclick="showHelp();"></td></tr>
<tr><td colspan=2 align=center><input type="button" id="mPrev" style="display:none;" class="btn" value="previous sequence" onclick="showPrev();"></td></tr>
</table>
</div>
<div id="credits">
<hr noshade width=100% size=1 color=#9AAEA2>
<font size=1 face=arial color="#9AAEA2">
Alien Sequence v1.1<br>
Last revision: 12.01.2002<br>
steve@slayeroffice.com<br>
<a href="http://www.slayeroffice.com" style="text-decoration:none;"><font color="#9AAEA2">http://www.slayeroffice.com</font></a>
<hr noshade width=100% size=1 color=#9AAEA2>
</font>
</div>
<div id="helper">
<font size=2><b>How to Play</b><font size=1>
<hr noshade width=100% size=1 color=#9AAEA2>
The object of Alien Sequence is to clear the entire game board of diamonds. <p>
The best way to think about it is to consider the diamonds to be "on", and the squares to be "off". When you turn an area on, it, along with all areas around it will flip to either their on or off state. For example, if you were to click on an "on" area surrounded by "off" areas, the area you clicked on would turn "off" and the areas around it would turn "on".
Areas that are up, down, left or right of the area you click are considered adjacent.
<p>Your job is to figure out what sequence you need to use to turn the entire board off. <p>Good Luck!<p>
<center><input type="button" class="btn" value="close" onClick="zDoc.helper.style.display='none';">
</div>
</body>