<html>
<HEAD>
<style type="text/css">
body { background-color: black; color: black }
a { font-weight: bold }
a:link { background-color: black; color: blue }
a:visited { background-color: black; color: blue }
a:active { background-color: black; color: blue }
a:hover { background-color: white; color: maroon}
input { font-family: monospace; font-size: 24px; border-left: 10px; border-right: 10px; border-color: silver; border-style: double }
</style>
a
<SCRIPT LANGUAGE="JavaScript">
var Size = new Number(7);
var Moves = new Array();
function Intro()
{
alert("WeLcOmE To OuR LoGiCaL Game CalLeD ZiPPo!.. \n Read the Guidelines below and CLick Ok to Continue.. ");
alert("Ready?? Play!");
NewGame();
}
function NewGame()
{
for(i = 0; i < Size * Size; document.forms[0].elements[i++].value = 0);
for(i = 0; i < 1 + 1 * document.forms[0].Difficulty.selectedIndex; i++)
NewValue(Math.floor(Math.random() * Size),Math.floor(Math.random() * Size),1);
if ( document.forms[0].Difficulty.selectedIndex == document.forms[0].Difficulty.selectedIndex)
{
alert( "Finish this level within "+(5 + 2 * document.forms[0].Difficulty.selectedIndex )+ " clicks"
);
}
Moves.length = document.forms[0].Score.value = 0;
}
function TakeBack(flag)
{
while(flag-- && (i = Moves.pop()))
NewValue(parseInt(i.split("-")[0]),parseInt(i.split("-")[1]),1);
document.forms[0].Score.value = Moves.length;
}
function Clicked(x,y)
{
NewValue(x,y,3);
document.forms[0].Score.value = Moves.push(x + "-" + y);
if (document.forms[0].Score.value > 5 + 2 * document.forms[0].Difficulty.selectedIndex )
{
document.forms[0].disabled=true;
alert((Moves.length <= 1 + 1 * document.forms[0].Difficulty.selectedIndex ? " " : "") + " You Failed in this level!! "+ " You must solve this puzzle within " +( 5 + 2 * document.forms[0].Difficulty.selectedIndex )+ " clicks...");
document.forms[0].disabled=false;
alert(" The game will start to its new format... ");
NewGame();
}
for(i = 0; i < Size * Size; i++)
if(parseInt(document.forms[0].elements[i].value))
return;
alert((Moves.length <= 1 + 1 * document.forms[0].Difficulty.selectedIndex ? "Hoooraaayy! ,\n" : "") + " You've Finished it in just " + Moves.length + " click(s)...");
alert("Now! Choose another level in Difficulty Settings below the puzzle box.....\n To test your logic, Choose higher level....");
// NewGame();
}
function NewValue(x,y,c)
{
ChangeValue(x,y,c);
ChangeValue(x - 1,y,c);
ChangeValue(x + 1,y,c);
ChangeValue(x,y - 1,c);
ChangeValue(x,y + 1,c);
ChangeValue(x + 1,y + 1,c);
ChangeValue(x - 1,y - 1,c);
ChangeValue(x - 1,y + 1,c);
ChangeValue(x + 1,y - 1,c);
}
function ChangeValue(x,y,c)
{
if(x >= 0 && x < Size && y >= 0 && y < Size)
with(document.forms[0].elements[x + Size * y]) value = (parseInt(value) + c) & 3;
}
</script>
</HEAD>
<BODY onLoad="Intro()">
<body background ="http://wallpaperstock.net/black-cat-head_wallpapers_3110_1600x1200.jpg">
<font face ="comic sans ms">
<center>
<hr>
<marquee>
<font size="30pt" color=#FF1493>
ZIPPO... ZIPPO... ZIPPO...
</font></marquee>
<br>
<hr>
</center>
<p align="center">
<a href="" onClick="NewGame(); return false;" onMouseOver="window.status='Start a new game'; return true;" onMouseOut="window.status=''; return true;" title="Start a new game">New</a> -
<a href="" onClick="TakeBack(-1); return false;" onMouseOver="window.status='Restart the board'; return true;" onMouseOut="window.status=''; return true;" title="Restart the board">Restart</a> -
<a href="" onClick="TakeBack(1); return false;" onMouseOver="window.status='Undo last move'; return true;" onMouseOut="window.status=''; return true;" title="Undo last move">Undo</a></p>
<center>
<form action="" method="get" enctype="application/x-www-form-urlencoded">
<script type="text/javascript">
<!--
for(y = 0; y < Size; y++,window.document.write("<br>"))
for(x = 0; x < Size; x++)
window.document.write('<input type="button" value="" onClick="Clicked(' + x + ',' + y + ')">');
</script>
<br>
<font color="#FF33CC">
Difficulty settings: <select name="Difficulty" onChange="NewGame()">
<option selected>Huh, what ?</option>
<option>Dumb</option>
<option>Real easy</option>
<option>Easy</option>
<option>Normal</option>
<option>Hard</option>
<option>Real hard</option>
<option>Master</option>
<option>Impossible</option>
</select>
Clicks used: <input type="text" name="Score" value="0" size="2" disabled>
</form></center>
<center>
GuideLines :
<br>
<li>Click on one of the buttons in the playing field to decrement that button's value by 1, <br>as well as the values of the 8 surrounding ones.
Objective:
<br>
<li>Set all buttons to '0'.
</center>
</body>
</html> </font>
phoenx 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.