/    Sign up×
Community /Pin to ProfileBookmark

need help for this puzzle game

the blue snail is only allowed to take one step to one of the eight boxes around and only once, and he has to go through all the boxes to reach the pink snail

here is what i have done so far, there’s something wrong, and i highlight the place where i don’t feel right, please tell me what the errors are

thanks

<script>
document.write(‘<table style=cursorointer;cursor:hand border=2 cellpadding=0 cellspacing=0>’)
var squarenum=0;
var curnum=0;
curcol=”#996633″;
for(var count1=0; count1<8; count1++){
document.write(‘<tr>’)
if(curcol==”#996633″) {curcol=”#663300″} else curcol=”#996633″;
for(var count=0; count<8; count++){
if(curcol==”#996633″) {curcol=”#663300″} else curcol=”#996633″;
[COLOR=Navy]document.write(‘<td bgcolor=’+curcol+’ id=’+curnum+’ name=’+squarenum+’ width=50 height=50 onclick=”moveto(this);”> </td>’);
curnum++;
squarenum++
}
document.write(‘</tr>’)
curnum+=;
}
document.write(‘</table>’)
document.getElementById(90).innerHTML=”<img width=40 height=40 src=romeo.gif>”;
document.getElementById(90).bgColor=”#FF99FF”;[/COLOR]

var squares=new Array(true);
var score=0;
var where;
var oldwhere=0;
[COLOR=Navy]function moveto(square){
where=square.id;
if ((oldwhere==where- || oldwhere==where- || oldwhere==where- || oldwhere==where- || oldwhere- ==where || oldwhere- ==where || oldwhere- ==where || oldwhere- ==where))[/COLOR]

{
score++;
document.getElementById(“scorey”).innerHTML=score;
document.getElementById(oldwhere).innerHTML=” “;
document.getElementById(where).innerHTML=”<img src=romeo.gif width=40 height=40>”;
document.getElementById(where).bgColor=”#FF99FF”;
oldwhere=where;
squares[square.name]=true;
}
for (var i=0; i<63; i++) if (squares[i]!=true) var stuffed=true
if (stuffed!=true) {alert(“You finally see Juliet again in only “+score+” moves!”);window.location.href=window.location.href;}
}
</script>

[upl-file uuid=fe60302b-0214-41f4-a260-1216fc94c00a size=6kB]back%20copy.gif[/upl-file]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @xiaogou spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...