Parag’s Den

Dedicated to my adored friends…..

Archive for the ‘2. Games’ Category

TicTac 3D

Posted by paragdongre on November 13, 2007

Hi Friends!
Simply copy this javascript code in notepad and save it as “.HTML” file format. Also download the images by clicking link below -> Tictac-3d.zip(Click to download)

[Note: Save the “.html”  file in downloaded folder i.e. tictac-3d. Plz dont make any type of updation in the code before copying it.]
—————————————————————————————–

 Javascript Code->

<HEAD>
<SCRIPT LANGUAGE=”JavaScript”>

<!– Begin
var i, j, k, RotAng, XMouseOver, YMouseOver, LastEvent, IsOver=true, IsStart0;
var Max, NDraw, Start, I_Sel, J_Sel, Start0;
var NeedBallDown, MoveCount, MaxMoveCount;
IsPlayer = new Array(2);
Level = new Array(2); 
Fld = new Array(4);
for (i=0; i<4; i++)
  Fld[i] = new Array(4);
for (i=0; i<4; i++)
{ for (j=0; j<4; j++)
    Fld[i][j] = new Array(4); 
}
ScreenFld = new Array(4);
for (i=0; i<4; i++)
  ScreenFld[i] = new Array(4);
for (i=0; i<4; i++)
{ for (j=0; j<4; j++)
    ScreenFld[i][j] = new Array(2); 
}
FldCount = new Array(4);
for (i=0; i<4; i++)
  FldCount[i] = new Array(4);
Value = new Array(4);
for (i=0; i<4; i++)
  Value[i] = new Array(4);
History = new Array(64);
for (i=0; i<64; i++)
  History[i] = new Array(2);
Pic= new Array(4);
Pic[0] = new Image(); Pic[0].src=”tt3d_0.gif” mce_src=”tt3d_0.gif”;
Pic[1] = new Image(); Pic[1].src=”tt3dred.gif” mce_src=”tt3dred.gif”;
Pic[2] = new Image(); Pic[2].src=”tt3d_1.gif” mce_src=”tt3d_1.gif”;
Pic[3] = new Image(); Pic[3].src=”tt3dblue.gif” mce_src=”tt3dblue.gif”;

IsStart0=true;
IsPlayer[0]=true;
IsPlayer[1]=false;
Level[0]=2;
Level[1]=3;

function Init()
{ var ii, jj, kk;
  for (ii=0; ii<4; ii++)
  { for (jj=0; jj<4; jj++)
    { for (kk=0; kk<4; kk++)
        Fld[ii][jj][kk]=0;
      FldCount[ii][jj]=0;
    }
  }
  if (IsStart0) Start0=true;
  else Start0=false;
  LastEvent=””;
  NeedBallDown=0;
  I_Sel=-1; J_Sel=-1;
  MoveCount=0;
  MaxMoveCount=0;
  RotAng=0;
  XMouseOver=-1;
  YMouseOver=-1;
  RefreshScreen();
  IsOver=false;
}

function SetOption(nn, mm)
{ if (nn<2)
  { if (mm==0)
      IsPlayer[nn]=true;
    else
      IsPlayer[nn]=false;
  }
  else IsStart0=mm;
}

function SetLevel(nn, mm)
{ Level[nn]=mm;
}

function Timer()
{ if (IsOver) return;
  if (NeedBallDown==0)
  { if ((((MoveCount+Start0)%2==1)&&(IsPlayer[0]))||
        (((MoveCount+Start0)%2==0)&&(IsPlayer[1])));
    else
    { if (LastEvent==””) GetBestMove(((MoveCount+1+Start0)%2)*2-1);
      if (LastEvent==”TurnLeft”) { TurnLeft(); LastEvent=””; }
      if (LastEvent==”TurnRight”) { TurnRight(); LastEvent=””; }
      if (LastEvent==”Back”) { Back(); LastEvent=””; }
      if (LastEvent==”Replay”) { Replay(); LastEvent=””; }       
    }
  }
  if (NeedBallDown>0)
  { if (Fld[I_Sel][J_Sel][NeedBallDown-1]==0)
    { if (NeedBallDown<4)
        window.document.images[13*(YMouseOver+3-NeedBallDown)+XMouseOver].src = Pic[2].src;
      if ((MoveCount+Start0)%2==1)
        window.document.images[13*(YMouseOver+4-NeedBallDown)+XMouseOver].src = Pic[1].src;
      else
        window.document.images[13*(YMouseOver+4-NeedBallDown)+XMouseOver].src = Pic[3].src;
    }
    if (NeedBallDown>1)
    { if (Fld[I_Sel][J_Sel][NeedBallDown-2]!=0)
        NeedBallDown=1;
    }
    if (NeedBallDown==1)
    { window.document.OptionsForm.Moves.value=MoveCount+1;
      MakeMove();
    }
    NeedBallDown–;
  }
}

function TurnLeft()
{ if (NeedBallDown>0) { LastEvent=”TurnLeft”; return; }
  RotAng–;
  if (RotAng<0) RotAng=7;
  RefreshScreen();
}

function TurnRight()
{ if (NeedBallDown>0) { LastEvent=”TurnRight”; return; }
  RotAng++;
  if (RotAng>7) RotAng=0;
  RefreshScreen();
}

function Back()
{ if (NeedBallDown>0) { LastEvent=”Back”; return; }
  if (MoveCount>0)
  { IsOver=false;
    MoveCount–;
    var ii=History[MoveCount][0];
    var jj=History[MoveCount][1];
    var kk=–FldCount[ii][jj];
    Fld[ii][jj][kk]=0;
    window.document.OptionsForm.Moves.value=MoveCount;
    RefreshPic(ii, jj, kk);
  }
}

function Replay()
{ if (NeedBallDown>0) { LastEvent=”Replay”; return; }
  if (MoveCount<MaxMoveCount)
  { I_Sel=History[MoveCount][0];
    J_Sel=History[MoveCount][1];
    window.document.OptionsForm.Moves.value=MoveCount+1;
    MakeMove();     
    RefreshPic(I_Sel, J_Sel, FldCount[I_Sel][J_Sel]-1);
  }
}

function MakeMove()
{ var ccol, kk;
  ccol=((MoveCount+1+Start0)%2)*2-1;
  kk=FldCount[I_Sel][J_Sel]++;
  Fld[I_Sel][J_Sel][kk]=ccol;
  if (History[MoveCount][0]!=I_Sel)
  { History[MoveCount][0]=I_Sel;
    MaxMoveCount=MoveCount+1;
  }
  if (History[MoveCount][1]!=J_Sel)
  { History[MoveCount][1]=J_Sel;
    MaxMoveCount=MoveCount+1;
  }
  MoveCount++;
  if (MaxMoveCount<MoveCount)
    MaxMoveCount=MoveCount;
  IsOver=IsWinning(I_Sel, J_Sel, kk, ccol);
  if (IsOver)
  { if (ccol<0) alert(“Red has won !”);
    else alert(“Blue has won !”);
  }
  else
  { if (MoveCount==64)
    { IsOver=true;
      alert(“Draw !”);
    }
  }
}

function GetBestMove(theCol)
{ var ii, jj, kk, zz, vv, vvbest, nn, cc=theCol;
  var iiw,jjw,kkw,wwcount;
  var LLevel=Level[(MoveCount+1+Start0)%2];
  I_Sel=-1; J_Sel=-1;
  for (ii=0; ii<4; ii++)
  { for (jj=0; jj<4; jj++)
    { if ((kk=FldCount[ii][jj])<4)
      { Fld[ii][jj][kk]=cc;
        if (IsWinning(ii, jj, kk, cc))
        { Fld[ii][jj][kk]=0;
          Select(ii, jj);
          return;
        }
        Fld[ii][jj][kk]=0;
      }
    }
  }
  nn=0;
  for (ii=0; ii<4; ii++)
  { for (jj=0; jj<4; jj++)
    { Value[ii][jj]=0;
      if ((kk=FldCount[ii][jj])<4)
      { nn++;
        Fld[ii][jj][kk]=-cc;
        if (IsWinning(ii, jj, kk, -cc))
        { Fld[ii][jj][kk]=0;
          Select(ii, jj);
          return;
        }
        Fld[ii][jj][kk]=0;
      }
    }
  }
  if (LLevel>2)
  { for (ii=0; ii<4; ii++)
    { for (jj=0; jj<4; jj++)
      { if ((kk=FldCount[ii][jj])<4)
        { wwcount=0;
          Fld[ii][jj][kk]=cc;
          if (kk<3)
          { if ((wwcount=CanWin(ii,jj,kk+1,cc))==2)
            { Fld[ii][jj][kk]=0;
              Select(ii, jj);
              return;
            }
          }
          if (wwcount>=0)
          { for (iiw=0; iiw<4; iiw++)    
            { for (jjw=0; jjw<4; jjw++)
              { if ((kkw=FldCount[iiw][jjw])<4)
                { if (!((ii==iiw)&&(jj==jjw)))
                  { Fld[iiw][jjw][kkw]=cc;
                    if (IsWinning(iiw, jjw, kkw, cc))
                      wwcount++;
                    Fld[iiw][jjw][kkw]=0;
                    if (wwcount>1)
                    { Fld[ii][jj][kk]=0;
                      Select(ii, jj);
                      return;
                    }
                  }
                }
              }
            }
          }
          Fld[ii][jj][kk]=0;
        }
      }
    }
  }
  if (LLevel>3)
  { for (ii=0; ii<4; ii++)
    { for (jj=0; jj<4; jj++)
      { if ((kk=FldCount[ii][jj])<4)
        { vv=0;
          Fld[ii][jj][kk]=cc;
          if (kk<3)
          { Fld[ii][jj][kk+1]=-cc;
            if (IsWinning(ii, jj, kk+1, -cc))
              vv=-1;
            Fld[ii][jj][kk+1]=0;
          }
          if (vv==0)
          { Fld[ii][jj][kk]=-cc;
            if(kk<3)
            { Fld[ii][jj][kk+1]=cc;
              if (IsWinning(ii, jj, kk+1, cc))
                Value[ii][jj]=-200;
              Fld[ii][jj][kk+1]=0;
            }
            for (iiw=0; iiw<4; iiw++)    
            { for (jjw=0; jjw<4; jjw++)
              { if ((kkw=FldCount[iiw][jjw])<4)
                { if (!((ii==iiw)&&(jj==jjw)))
                  { if ((vv=CanWin(iiw,jjw,kkw,-cc))==2)
                    { Fld[ii][jj][kk]=0;
                      Select(ii, jj);
                      return;
                    }
                    if (vv==-1)
                    Value[ii][jj]=-100;
                  }
                }
              }
            }
            Fld[ii][jj][kk]=cc;
            if (kk<3)
            { Fld[ii][jj][kk+1]=-cc;
              for (iiw=0; iiw<4; iiw++)    
              { for (jjw=0; jjw<4; jjw++)
                { if ((kkw=FldCount[iiw][jjw])<4)
                  { if (!((ii==iiw)&&(jj==jjw)))
                    { if (CanWin(iiw,jjw,kkw,-cc)==2)
                        Value[ii][jj]=-5000;
                    }
                  }
                }
              }
              Fld[ii][jj][kk+1]=0;
            }
          }
          Fld[ii][jj][kk]=0;
        }
      }
    }
  }
  if (nn==0)
  { IsOver=true; return; }
  zz=0; 
  nn=0;
  for (ii=0; ii<4; ii++)
  { for (jj=0; jj<4; jj++)
    { if ((kk=FldCount[ii][jj])<4)
      { Fld[ii][jj][kk]=cc;
        if (kk<3)
        { Fld[ii][jj][kk+1]=-cc;
          if (IsWinning(ii, jj, kk+1, -cc))
          { vv=-8100;
            Fld[ii][jj][kk+1]=0;
          }
          else
          { Fld[ii][jj][kk+1]=0;
            vv=GetValue(ii, jj, kk, cc);
          }
        }
        else
          vv=GetValue(ii, jj, kk, cc);
        if (LLevel<2) vv%=200;
        if (LLevel<3) vv+=Math.floor(Math.random()*108);
        if (LLevel==3) vv+=Math.floor(Math.random()*27);
        Value[ii][jj]+=vv;
        if (zz==0) vvbest=Value[ii][jj];
        zz++;
        if (Value[ii][jj]==vvbest)
          nn++;
        if (Value[ii][jj]>vvbest)
        { nn=1;
          vvbest=Value[ii][jj];
        }
        Fld[ii][jj][kk]=0;
      }
    }
  }
  zz=Math.floor(Math.random()*nn);
  nn=-1;
  for (ii=0; ii<4; ii++)
  { for (jj=0; jj<4; jj++)
    { if ((kk=FldCount[ii][jj])<4)
      { if (vvbest==Value[ii][jj])
        { nn++;
          if (nn==zz)
          { Select(ii, jj);
            return;
          }
        }
      }
    }
  }
}

function CanWin(ii, jj, kk, cc)
{ var kkl, kkk=kk-1;
  var vv=0;
  do
  { kkk++;
    Fld[ii][jj][kkk]=-cc;
    if ((IsWinning(ii, jj, kkk, -cc)))
    { for (kkl=kk; kkl<=kkk; kkl++)
        Fld[ii][jj][kkl]=0;
      if (kkk==kk) return(-1);
      else return(vv);
    }
    Fld[ii][jj][kkk]=cc;
    if ((IsWinning(ii, jj, kkk, cc))&&(kkk<3))
    { if (kkk==kk) vv++;
      Fld[ii][jj][kkk]=-cc;
      Fld[ii][jj][kkk+1]=cc;
      if ((IsWinning(ii, jj, kkk+1, cc)))
      { for (kkl=kk; kkl<=kkk+1; kkl++)
          Fld[ii][jj][kkl]=0;
        return(2);
      }
      Fld[ii][jj][kkk+1]=0;
    }
    Fld[ii][jj][kkk]=-cc;
  }
  while (kkk<3);
  for (kkl=kk; kkl<=kkk; kkl++)
    Fld[ii][jj][kkl]=0;
  return(vv);
}

function GetValue(ii, jj, kk, ccol)
{ var ll, cc, ccount1, ccount2, vval=0;
  var dd1, dd2, ddv, ddd, ddr;
  if (MoveCount%2==0)
  { dd1=1;
    dd2=1;
    ddv=(3-kk)*2;
    ddd=4; ddr=4;
    if (kk==2)
    { ddd=8; ddr=8; }
  }
  else
  { dd1=1;
    dd2=1;
    ddv=(3-kk)*(3-kk)+1;
    ddd=4; ddr=4;
    if (kk==2)
    { ddd=8; ddr=8; }
  }
  var ss1=0;
  var ss2=0;
  var ww1count=3*dd1;
  var ww1=0;
  var ww2count=2*dd2;
  var ww2=0;
  ccount1=0;
  ccount2=0;
  for (ll=0; ll<4; ll++)
  { if ((cc=Fld[ll][jj][kk])==ccol) ccount1+=dd1;
    if (cc==-ccol) ccount2+=dd2;
  }
  if ((ccount1>dd1)&&(ccount2>0));
  else
  { vval+=(ccount1+1)*(ccount2+1)*ddv;
    ss1+=ccount1-dd1; ss2+=ccount2;
    if (ccount1>=ww1count) ww1++;
    if (ccount2>=ww2count) ww2++;
  }
  ccount1=0;
  ccount2=0;
  for (ll=0; ll<4; ll++)
  { if ((cc=Fld[ii][ll][kk])==ccol) ccount1+=dd1;
    if (cc==-ccol) ccount2+=dd2;
  }
  if ((ccount1>dd1)&&(ccount2>0));
  else
  { vval+=(ccount1+1)*(ccount2+1)*ddv;
    ss1+=ccount1-dd1; ss2+=ccount2;
    if (ccount1>=ww1count) ww1++;
    if (ccount2>=ww2count) ww2++;
  }
  ccount1=0;
  ccount2=0;
  for (ll=0; ll<=kk; ll++)
  { if ((cc=Fld[ii][jj][ll])==ccol) ccount1+=dd1;
    if (cc==-ccol) ccount2+=dd2;
  }
  if ((ccount1>dd1)&&(ccount2>0));
  else
  { vval+=(ccount1+1)*(ccount2+1)*ddv;
    ss1+=ccount1-dd1; ss2+=ccount2;
    if (ccount1>=ww1count) ww1++;
    if (ccount2>=ww2count) ww2++;
  }
  if (jj==kk)
  { ccount1=0;
    ccount2=0;
    for (ll=0; ll<4; ll++)
    { if ((cc=Fld[ii][ll][ll])==ccol) ccount1+=dd1;
      if (cc==-ccol) ccount2+=dd2;
    }
    if ((ccount1>dd1)&&(ccount2>0));
    else
    { vval+=(ccount1+1)*(ccount2+1)*ddd;
      ss1+=ccount1-dd1; ss2+=ccount2;
      if (ccount1>=ww1count) ww1++;
      if (ccount2>=ww2count) ww2++;
    }
  }
  if ((3-jj)==kk)
  { ccount1=0;
    ccount2=0;
    for (ll=0; ll<4; ll++)
    { if ((cc=Fld[ii][3-ll][ll])==ccol) ccount1+=dd1;
      if (cc==-ccol) ccount2+=dd2;
    }
    if ((ccount1>dd1)&&(ccount2>0));
    else
    { vval+=(ccount1+1)*(ccount2+1)*ddd;
      ss1+=ccount1-dd1; ss2+=ccount2;
      if (ccount1>=ww1count) ww1++;
      if (ccount2>=ww2count) ww2++;
    }
  }
  if (ii==kk)
  { ccount1=0;
    ccount2=0;
    for (ll=0; ll<4; ll++)
    { if ((cc=Fld[ll][jj][ll])==ccol) ccount1+=dd1;
      if (cc==-ccol) ccount2+=dd2;
    }
    if ((ccount1>dd1)&&(ccount2>0));
    else
    { vval+=(ccount1+1)*(ccount2+1)*ddd;
      ss1+=ccount1-dd1; ss2+=ccount2;
      if (ccount1>=ww1count) ww1++;
      if (ccount2>=ww2count) ww2++;
    }
  }
  if ((3-ii)==kk)
  { ccount1=0;
    ccount2=0;
    for (ll=0; ll<4; ll++)
    { if ((cc=Fld[3-ll][jj][ll])==ccol) ccount1+=dd1;
      if (cc==-ccol) ccount2+=dd2;
    }
    if ((ccount1>dd1)&&(ccount2>0));
    else
    { vval+=(ccount1+1)*(ccount2+1)*ddd;
      ss1+=ccount1-dd1; ss2+=ccount2;
      if (ccount1>=ww1count) ww1++;
      if (ccount2>=ww2count) ww2++;
    }
  }
  if (jj==ii)
  { ccount1=0;
    ccount2=0;
    for (ll=0; ll<4; ll++)
    { if ((cc=Fld[ll][ll][kk])==ccol) ccount1+=dd1;
      if (cc==-ccol) ccount2+=dd2;
    }
    if ((ccount1>dd1)&&(ccount2>0));
    else
    { vval+=(ccount1+1)*(ccount2+1)*ddd;
      ss1+=ccount1-dd1; ss2+=ccount2;
      if (ccount1>=ww1count) ww1++;
      if (ccount2>=ww2count) ww2++;
    }
  }                         
  if ((3-jj)==ii)
  { ccount1=0;
    ccount2=0;
    for (ll=0; ll<4; ll++)
    { if ((cc=Fld[ll][3-ll][kk])==ccol) ccount1+=dd1;
      if (cc==-ccol) ccount2+=dd2;
    }
    if ((ccount1>dd1)&&(ccount2>0));
    else
    { vval+=(ccount1+1)*(ccount2+1)*ddd;
      ss1+=ccount1-dd1; ss2+=ccount2;
      if (ccount1>=ww1count) ww1++;
      if (ccount2>=ww2count) ww2++;
    }
  }                       
  if ((ii==jj)&&(jj==kk))
  { ccount1=0;
    ccount2=0;
    for (ll=0; ll<4; ll++)
    { if ((cc=Fld[ll][ll][ll])==ccol) ccount1+=dd1;
      if (cc==-ccol) ccount2+=dd2;
    }
    if ((ccount1>dd1)&&(ccount2>0));
    else
    { vval+=(ccount1+1)*(ccount2+1)*ddr;
      ss1+=ccount1-dd1; ss2+=ccount2;
      if (ccount1>=ww1count) ww1++;
      if (ccount2>=ww2count) ww2++;
    }
  }
  if ((ii==kk)&&((3-jj)==kk))
  { ccount1=0;
    ccount2=0;
    for (ll=0; ll<4; ll++)
    { if ((cc=Fld[ll][3-ll][ll])==ccol) ccount1+=dd1;
      if (cc==-ccol) ccount2+=dd2;
    }
    if ((ccount1>dd1)&&(ccount2>0));
    else
    { vval+=(ccount1+1)*(ccount2+1)*ddr;
      ss1+=ccount1-dd1; ss2+=ccount2;
      if (ccount1>=ww1count) ww1++;
      if (ccount2>=ww2count) ww2++;
    }
  }
  if ((ii==jj)&&(jj==(3-kk)))
  { ccount1=0;
    ccount2=0;
    for (ll=0; ll<4; ll++)
    { if ((cc=Fld[ll][ll][3-ll])==ccol) ccount1+=dd1;
      if (cc==-ccol) ccount2+=dd2;
    }
    if ((ccount1>dd1)&&(ccount2>0));
    else
    { vval+=(ccount1+1)*(ccount2+1)*ddr;
      ss1+=ccount1-dd1; ss2+=ccount2;
      if (ccount1>=ww1count) ww1++;
      if (ccount2>=ww2count) ww2++;
    }
  }
  if (((3-ii)==kk)&&(jj==kk))
  { ccount1=0;
    ccount2=0;
    for (ll=0; ll<4; ll++)
    { if ((cc=Fld[3-ll][ll][ll])==ccol) ccount1+=dd1;
      if (cc==-ccol) ccount2+=dd2;
    }
    if ((ccount1>dd1)&&(ccount2>0));
    else
    { vval+=(ccount1+1)*(ccount2+1)*ddr;
      ss1+=ccount1-dd1; ss2+=ccount2;
      if (ccount1>=ww1count) ww1++;
      if (ccount2>=ww2count) ww2++;
    }
  }
  if (ww1>1) vval+=ww1*4000;
  if (ss1>3*dd1) vval+=(ss1-3*dd1)*20;
  if ((ww2>=1)&&(ss2>2*dd2)) vval+=(ss2-2*dd2)*(kk+1)*50;
  if (ww2>1) vval+=ww2*500;
  return(vval);
}

function IsWinning(ii, jj, kk, ccol)
{ var ll, ccount;
  ccount=0;
  for (ll=0; ll<4; ll++)
  { if (Fld[ll][jj][kk]==ccol) ccount++;
  }
  if (ccount==4) return(true);
  ccount=0;
  for (ll=0; ll<4; ll++)
  { if (Fld[ii][ll][kk]==ccol) ccount++;
  }
  if (ccount==4) return(true);
  ccount=0;
  for (ll=0; ll<=kk; ll++)
  { if (Fld[ii][jj][ll]==ccol) ccount++;
  }
  if (ccount==4) return(true);
  if (jj==kk)
  { ccount=0;
    for (ll=0; ll<4; ll++)
    { if (Fld[ii][ll][ll]==ccol) ccount++;
    }
    if (ccount==4) return(true);
  }
  if ((3-jj)==kk)
  { ccount=0;
    for (ll=0; ll<4; ll++)
    { if (Fld[ii][3-ll][ll]==ccol) ccount++;
    }
    if (ccount==4) return(true);
  }
  if (ii==kk)
  { ccount=0;
    for (ll=0; ll<4; ll++)
    { if (Fld[ll][jj][ll]==ccol) ccount++;
    }
    if (ccount==4) return(true);
  }
  if ((3-ii)==kk)
  { ccount=0;
    for (ll=0; ll<4; ll++)
    { if (Fld[3-ll][jj][ll]==ccol) ccount++;
    }
    if (ccount==4) return(true);
  }
  if (jj==ii)
  { ccount=0;
    for (ll=0; ll<4; ll++)
    { if (Fld[ll][ll][kk]==ccol) ccount++;
    }
    if (ccount==4) return(true);
  }
  if ((3-jj)==ii)
  { ccount=0;
    for (ll=0; ll<4; ll++)
    { if (Fld[ll][3-ll][kk]==ccol) ccount++;
    }
    if (ccount==4) return(true);
  }
  if ((ii==jj)&&(jj==kk))
  { ccount=0;
    for (ll=0; ll<4; ll++)
    { if (Fld[ll][ll][ll]==ccol) ccount++;
    }
    if (ccount==4) return(true);
  }
  if ((ii==kk)&&((3-jj)==kk))
  { ccount=0;
    for (ll=0; ll<4; ll++)
    { if (Fld[ll][3-ll][ll]==ccol) ccount++;
    }
    if (ccount==4) return(true);
  }
  if ((ii==jj)&&(jj==(3-kk)))
  { ccount=0;
    for (ll=0; ll<4; ll++)
    { if (Fld[ll][ll][3-ll]==ccol) ccount++;
    }
    if (ccount==4) return(true);
  }
  if (((3-ii)==kk)&&(jj==kk))
  { ccount=0;
    for (ll=0; ll<4; ll++)
    { if (Fld[3-ll][ll][ll]==ccol) ccount++;
    }
    if (ccount==4) return(true);
  }
  return(false);
}

function Select(ii, jj)
{ I_Sel=ii;
  J_Sel=jj;
  XMouseOver=ScreenFld[ii][jj][0];
  YMouseOver=ScreenFld[ii][jj][1];
  NeedBallDown=4;
}

function Clicked(xx, yy)
{ if (IsOver) return;
  if (NeedBallDown>0) return;
  MouseOut();
  MouseOver(xx, yy);
  if (XMouseOver>=0)
    NeedBallDown=4;
  window.document.OptionsForm.Moves.focus();
  window.document.OptionsForm.Moves.blur();

function MouseOver(xx, yy)
{ if (IsOver) return;
  if (XMouseOver>=0) return;
  if ((((MoveCount+Start0)%2==1)&&(IsPlayer[0]))||
      (((MoveCount+Start0)%2==0)&&(IsPlayer[1])))
  { if (NeedBallDown==0)
    { for (ii=0; ii<4; ii++)
      { for (jj=0; jj<4; jj++)
        { if ((ScreenFld[ii][jj][0]==xx)&&(ScreenFld[ii][jj][1]==yy))
          { if (Fld[ii][jj][3]==0)
            { if ((MoveCount+Start0)%2==1)
                window.document.images[13*yy+xx].src = Pic[1].src;
              else
                window.document.images[13*yy+xx].src = Pic[3].src;
              XMouseOver=xx;
              YMouseOver=yy;
              I_Sel=ii;
              J_Sel=jj;
            }
          }
        }
      }
    }
  }
}

function MouseOut()
{ if (IsOver) return;
  if (XMouseOver>=0)
  { if (NeedBallDown==0)
    { for (ii=0; ii<4; ii++)
      { for (jj=0; jj<4; jj++)
        { if ((ScreenFld[ii][jj][0]==XMouseOver)&&(ScreenFld[ii][jj][1]==YMouseOver))
            window.document.images[13*YMouseOver+XMouseOver].src = Pic[2+Fld[ii][jj][3]].src;
        }
      }
      XMouseOver=-1;
    }
  }

function RefreshPic(ii, jj, kk)
{ var xx=ScreenFld[ii][jj][0];
  var yy=ScreenFld[ii][jj][1];
  window.document.images[13*(yy+3-kk)+xx].src = Pic[2+Fld[ii][jj][kk]].src;
}

function RefreshScreen()
{ var ii, jj, kk, xx, yy;
  for (ii=0; ii<13; ii++)
  { for (jj=0; jj<13; jj++)
      window.document.images[13*ii+jj].src = Pic[0].src;
  }
  for (ii=0; ii<4; ii++)
  { for (jj=0; jj<4; jj++)
    { if (RotAng==0) { xx=3*ii+jj; yy=9-2*jj+ii; }
      if (RotAng==1) { xx=3*ii+3-jj; yy=9-2*jj+3-ii; }
      if (RotAng==2) { xx=3*(3-jj)+ii; yy=9-2*ii+(3-jj); }
      if (RotAng==3) { xx=3*(3-jj)+3-ii; yy=9-2*ii+3-(3-jj); }
      if (RotAng==4) { xx=3*(3-ii)+(3-jj); yy=9-2*(3-jj)+(3-ii); }
      if (RotAng==5) { xx=3*(3-ii)+3-(3-jj); yy=9-2*(3-jj)+3-(3-ii); }
      if (RotAng==6) { xx=3*jj+(3-ii); yy=9-2*(3-ii)+jj; }
      if (RotAng==7) { xx=3*jj+3-(3-ii); yy=9-2*(3-ii)+3-jj; }
      ScreenFld[ii][jj][0]=xx;
      ScreenFld[ii][jj][1]=yy-3;    
      for (kk=0; kk<4; kk++)
        window.document.images[13*(yy-kk)+xx].src = Pic[2+Fld[ii][jj][kk]].src;
    }
  }
  window.document.OptionsForm.Moves.value=MoveCount;
}

function Resize()
{ if(navigator.appName == “Netscape”) history.go(0);
}
//  End –>
</script>

</HEAD>

<BODY onResize=”javascript:Resize()”>

<DIV ALIGN=center>
<table noborder cellpadding=10 cellspacing=0 width=650 heigth=390>
<tr height=100%>
  <td width=60%>
    <table border cellpadding=10 cellspacing=0 bgcolor=#FFFFCC width=100%><tr><td>
      <table noborder cellpadding=0 cellspacing=0><tr><td>
      <script language=”JavaScript”>
      document.open(“text/plain”);
      for (j=0; j < 13; j++)
      { for (i=0; i < 13; i++)
          document.write(“<a href=\”javascript:Clicked(“+i+”,”+j+”)\” onMouseOver=\”MouseOver(“+i+”,”+j+”)\” onMouseOut=\”MouseOut()\”><IMG src=\”tt3d_0.gif\” border=0></a>”);
        document.writeln(“<BR>”);
      }
      document.close();
      </script>
      </td></tr></table>
    </td></tr></table>
  </td>
  <td width=40%><form name=”OptionsForm”>
      <table noborder cellpadding=0 cellspacing=0 width=100%>
      <tr><td> </td></tr>
      <tr><td>
        <table border cellpadding=2 cellspacing=0 width=100%>
        <tr><td><input type=radio name=”Red” checked value=”Red: Player” onClick=”javascript:SetOption(0,0)”> Red: Player</td></tr>
        <tr><td><input type=radio name=”Red” value=”Red: Computer” onClick=”javascript:SetOption(0,1)”> Red: Computer</td></tr>
        <tr><td> Level:
                <input type=radio name=”RedLevel” value=”1″ onClick=”javascript:SetLevel(0,1)”>1
                <input type=radio name=”RedLevel” checked value=”2″ onClick=”javascript:SetLevel(0,2)”>2
                <input type=radio name=”RedLevel” value=”3″ onClick=”javascript:SetLevel(0,3)”>3
                <input type=radio name=”RedLevel” value=”4″ onClick=”javascript:SetLevel(0,4)”>4
        </td></tr>
        </table>     
      </td></tr>
      <tr><td> </td></tr>
      <tr><td>
        <table border cellpadding=2 cellspacing=0 width=100%>
        <tr><td><input type=radio name=”Blue” value=”Blue: Player” onClick=”javascript:SetOption(1,0)”> Blue: Player</td></tr>
        <tr><td><input type=radio name=”Blue” checked value=”Blue: Computer” onClick=”javascript:SetOption(1,1)”> Blue: Computer</td></tr>
        <tr><td> Level:
                <input type=radio name=”BlueLevel” value=”1″ onClick=”javascript:SetLevel(1,1)”>1
                <input type=radio name=”BlueLevel” value=”2″ onClick=”javascript:SetLevel(1,2)”>2
                <input type=radio name=”BlueLevel” checked value=”3″ onClick=”javascript:SetLevel(1,3)”>3
                <input type=radio name=”BlueLevel” value=”4″ onClick=”javascript:SetLevel(1,4)”>4
        </td></tr>
        </table>
      </td></tr>
      <tr><td> </td></tr>
      <tr><td>
        <table border cellpadding=2 cellspacing=0 width=100%>
        <tr><td width=50%><input type=radio name=”Start” checked value=”Red” onClick=”javascript:SetOption(2,1)”> Red begins</td>
        <td><input type=radio name=”Start” value=”Blue” onClick=”javascript:SetOption(2,0)”> Blue begins</td></tr>
        </table>
      </td></tr>
      <tr><td> </td></tr>
      <tr><td>
        <table border cellpadding=2 cellspacing=0 width=100%><tr>
        <td width=30% align=center><input type=button value=”<-” width=60 style=”width:60″ onClick=”javascript:TurnLeft()”></td>
        <td width=40% align=center><input type=button value=”NEW” width=80 style=”width:80″ onClick=”javascript:Init()”></td>
        <td width=30% align=center><input type=button value=”->” width=60 style=”width:60″ onClick=”javascript:TurnRight()”></td>
        </tr></table>
      </td></tr>
      <tr><td> </td></tr>
      <tr><td>
        <table border cellpadding=2 cellspacing=0 width=100%><tr>
        <td width=40% align=center><input type=button value=”<<” width=80 style=”width:80″ onClick=”javascript:Back()”></td>
        <td width=20% align=center><input size=3 name=”Moves”></td>
        <td width=40% align=center><input type=button value=”>>” width=80 style=”width:80″ onClick=”javascript:Replay()”></td>
        </tr></table>
      </td></tr>
      </table>
  </form></td>
</tr>
</table>
</DIV>
<script language=”JavaScript”>
Init();
setInterval(“Timer()”,400);
</script>

Advertisements

Posted in 2. Games | Leave a Comment »

Tic Tac Toe

Posted by paragdongre on November 5, 2007

Hi Friends!
Now u must used to it, so need not to tell you that what you suppose to do.
Simply copy paste this javascript code in notepad and save it as “.HTML” file format.
and start playing.

[Note: Plz dont make any type of updation in the code before copying it.]
————————————————————————-

<html>
<body>
  <SCRIPT LANGUAGE=”LiveScript”>
        <!–
  step = 0;
  diff=3;
  // change board when button is clicked
        function clear_all(form) {
   step = 0;
   for (i=0;i<9; ++i) {
    position=”a”+i;
    form[position].value=””;
   }
  }
  // change board when button is clicked
        function clickit(field) {
  if (step == -1) {alert(“Reset to play again”); return;}

        position=field.name.substring(1,2,1);
        position = ‘a’+position;
  if (field.form[position].value !=””) {alert(“Can’t go there”); return;}
        field.form[position].value=”X”;
        if (eval_pos(field.form)) {
   field.form.output.value=”You Win!”;
   step = -1;
   return;
  }
        position=get_move(field.form);
        field.form.output.value=’I moved to ‘ + position.substring(1,2,1);
  if (position==””) {
   field.form.output.value=”No Winner.”;
   step = -1;

   return;
  }
        field.form[position].value=”O”;
        if (eval_pos(field.form)) {
   field.form.output.value=”You Lose!”;
   step = -1;
  }
        }

  // see if there is a winner
        function eval_pos(form) {
     if ((form.a0.value!=”” &&
   form.a0.value==form.a3.value && form.a0.value==form.a6.value)||

        (form.a0.value!=””
   && form.a0.value==form.a1.value && form.a0.value==form.a2.value) ||
        (form.a0.value!=””
   && form.a0.value==form.a4.value && form.a0.value==form.a8.value) ||
        (form.a1.value!=””
   && form.a1.value==form.a4.value && form.a1.value==form.a7.value) ||
        (form.a2.value!=””
   && form.a2.value==form.a5.value && form.a2.value==form.a8.value) ||
        (form.a2.value!=””
   && form.a2.value==form.a4.value && form.a2.value==form.a6.value) ||
        (form.a3.value!=””
   && form.a3.value==form.a4.value && form.a3.value==form.a5.value) ||
        (form.a6.value!=””
   && form.a6.value==form.a7.value && form.a6.value==form.a8.value))
   return true;
  else 
           return false;
        }

  function f(a) {
  if (a == “”) return “.”; else return a;
  }

  // get position for move.
        function comp_move(form,player,weight,depth) {

            var cost;
   var bestcost=-2;
   var position;
   var newplayer;
   if (player==”X”) newplayer=”O”; else newplayer=”X”;
   if (depth==diff) return 0;

   if (eval_pos(form)) return 1;
   for (var i=0; i<9; ++i) {
    position=’a’+i;
    if (form[position].value != “”)
     continue;
    form[position].value=player;
    cost = comp_move(form,newplayer, -weight, depth+1);
    if (cost > bestcost) {
     bestcost=cost;
     if (cost==1) i=9;
    }
    form[position].value=””;
   }
   if (bestcost==-2) bestcost=0;
   return(-bestcost);
  }

  // get position for move.
        function get_move(form) {
   var cost;
   var bestcost=-2;
   bestmove=””;
   // don’t think about first move.
   if (step++ == 0)
    if (form.a4.value==””)
     return “a4”;
    else
    if (form.a0.value==””)
     return “a0”;

   for (var i=0; i<9; ++i) {
    localposition=’a’+i;
    if (form[localposition].value != “”)
     continue;
    form[localposition].value=”O”;
    cost=comp_move(form,”X”, -1, 0);
    if (cost > bestcost) {
     if (cost==1) i=9;
     bestmove=localposition;
     bestcost=cost;
    }
    form[localposition].value=””;
   }
   return bestmove;
        }

  // complain if user attempts to change board
        function complain(field) {
   field.form.output.focus(); // put focus eleswhere
   alert(“Don’t change the game fields directly!”);
        }

        // the end –>
      </SCRIPT>
<center>
<font face =”Georgia” ><b>Simply click on the buttons next to textbox in which u want to tic.</b></font>
    <FORM>
 <INPUT SIZE=1 NAME=”a0″ OnFocus=”complain(this)”>
 <INPUT TYPE=”button” NAME=”b0″ OnClick=”clickit(this)”>
 <INPUT SIZE=1 NAME=”a1″ OnFocus=”complain(this)”>
 <INPUT TYPE=”button” NAME=”b1″ OnClick=”clickit(this)”>
 <INPUT SIZE=1 NAME=”a2″ OnFocus=”complain(this)”>
 <INPUT TYPE=”button” NAME=”b2″ OnClick=”clickit(this)”>
    <BR>

 <INPUT SIZE=1 NAME=”a3″ OnFocus=”complain(this)”>
 <INPUT TYPE=”button” NAME=”b3″ OnClick=”clickit(this)”>
 <INPUT SIZE=1 NAME=”a4″ OnFocus=”complain(this)”>
 <INPUT TYPE=”button” NAME=”b4″ OnClick=”clickit(this)”>
 <INPUT SIZE=1 NAME=”a5″ OnFocus=”complain(this)”>
 <INPUT TYPE=”button” NAME=”b5″ OnClick=”clickit(this)”>
    <BR>

 <INPUT SIZE=1 NAME=”a6″ OnFocus=”complain(this)”>
 <INPUT TYPE=”button” NAME=”b6″ OnClick=”clickit(this)”>
 <INPUT SIZE=1 NAME=”a7″ OnFocus=”complain(this)”>
 <INPUT TYPE=”button” NAME=”b7″ OnClick=”clickit(this)”>
 <INPUT SIZE=1 NAME=”a8″ OnFocus=”complain(this)”>
 <INPUT TYPE=”button” NAME=”b8″ OnClick=”clickit(this)”>
    <BR>
    <BR>
    <BR>
 Message: <INPUT NAME=”output” TYPE=”text”><BR>
    <BR>
 Difficulty: <SELECT NAME=”difficulty”
  OnChange=”diff=form.difficulty[form.difficulty.selectedIndex].value;”>
 <OPTION VALUE=1> Very Easy
 <OPTION VALUE=2> Easy
 <OPTION VALUE=3 SELECTED> Medium
 <OPTION VALUE=4> Hard (may think a long time)
 </SELECT>
 <BR><INPUT TYPE=”button” VALUE=”Let Computer Start First” OnClick=”
  if (!step++) this.form.a4.value=’O’;”>

 <BR><INPUT TYPE=”reset” VALUE=”Restart” OnClick=”clear_all(this.form)”>

  
 </FORM>
</center>
</HTML>

Posted in 2. Games | Leave a Comment »

Arrange block.

Posted by paragdongre on November 1, 2007

Hi friends!
Just Copy paste this JavaScript code in to notepad, Save it in “.HTML” format.
And start playing. 
Hope you will enjoy this.
[Note: Plz dont make any type of updation in the code before copying it.]

———————————————————————
Javascript Code->
<HEAD>
<style>
.bigcell {

background-color:#aa9966;

  border:4px solid #aa9966;

  text-align:center;

}

.cell {

  width:40px;

  height:40px;

  font-family:Verdana, Arial;

  font-size:10pt;

  font-weight:bold;

  background-color:#996633;

  color:#ffff33;

  border-top:2px solid #aa9966;

  border-left:2px solid #aa9966;

  border-right:2px solid #663300;

  border-bottom:2px solid #663300;

  text-align:center;

}

.hole {

  width:40px;

  height:40px;

  background-color:#aa9966;

  text-align:center;

}

body,h1,h2,h3,.msg,capt1,capt2 {font-family:Verdana,Comic Sans MS,Arial;}

body {margin:0px;}

h1 {font-size:28pt; font-weight:bold; margin-bottom:0px;}

h2 {font-size:16pt; margin:0px; font-weight:bold;}

h3 {font-size:8pt; margin:0px; font-weight:bold;}

.msg {font-size:8pt; font-weight:bold;}

.tab {cursor:hand;}

.capt1 {font-size:10pt; font-weight:bold;}

.capt2 {font-size:9pt; font-weight:bold;}

.capt3 {font-size:14pt; font-weight:bold; color:yellow;}

.capt4 {font-size:10pt; font-weight:bold; color:yellow;}

.but {font-size:9pt; font-weight:bold; height:30px;background-color:#aaaa99;}

</style>
</HEAD>

<BODY onLoad=”loadBoard(4)”>
<script>

var gsize, ghrow, ghcol, gtime, gmoves, gintervalid=-1, gshuffling;

function toggleHelp()

{

  if (butHelp.value == “Hide Help”)

  {

    help.style.display = “none”;

    butHelp.value = “Show Help”;

  }

  else

  {

    help.style.display = “”;

    butHelp.value = “Hide Help”;

  } 

}

//random number between low and hi

function r(low,hi)

{

  return Math.floor((hi-low)*Math.random()+low);

}

//random number between 1 and hi

function r1(hi)

{

  return Math.floor((hi-1)*Math.random()+1);

}

//random number between 0 and hi

function r0(hi)

{

  return Math.floor((hi)*Math.random());

}

function startGame()
{

  shuffle();

  gtime = 0;

  gmoves = 0;

  tickTime();

  gintervalid = setInterval(“tickTime()”,1000);
}
function stopGame()
{

  if (gintervalid==-1) return;

  clearInterval(gintervalid);

  fldStatus.innerHTML = “”;

  gintervalid=-1;

}

function tickTime()
{

  showStatus();

  gtime++;

}

function checkWin()

{
  var i, j, s;

  if (gintervalid==-1) return; //game not started!

  if (!isHole(gsize-1,gsize-1)) return;

  for (i=0;i<gsize;i++)

    for (j=0;j<gsize;j++)

    {

      if (!(i==gsize-1 && j==gsize-1)) //ignore last block (ideally a hole)

      {

       if (getValue(i,j)!=(i*gsize+j+1).toString()) return;

      }

    }

  stopGame();

  s = “<table cellpadding=4>”;

  s += “<tr><td align=center class=capt3>!! CONGRATS !!</td></tr>”;

  s += “<tr class=capt4><td align=center>You have done it in ” + gtime + ” secs “;

  s += “with ” + gmoves + ” moves!</td></tr>”;

  s += “<tr><td align=center class=capt4>Your speed is ” + Math.round(1000*gmoves/gtime)/1000 + ” moves/sec</td></tr>”;

  s += “</table>”;

  fldStatus.innerHTML = s;

//  shuffle();

}

function showStatus()

{

  fldStatus.innerHTML = “Time: ” + gtime + ” secs   Moves: ” + gmoves

}

function showTable()

{

  var i, j, s;

  stopGame();

  s = “<table border=3 cellpadding=0 cellspacing=0 bgcolor=’#666655′><tr><td class=bigcell>”;

  s = s + “<table border=0 cellpadding=0 cellspacing=0>”;

  for (i=0; i<gsize; i++)

  {

    s = s + “<tr>”;   

    for (j=0; j<gsize; j++)

    {

      s = s + “<td id=a_” + i + “_” + j + ” onclick=’move(this)’ class=cell>” + (i*gsize+j+1) + “</td>”;

    }

    s = s + “</tr>”;       

  }

  s = s + “</table>”;

  s = s + “</td></tr></table>”;     

  return s;

}

function getCell(row, col)

{

  return eval(“a_” + row + “_” + col);

}

function setValue(row,col,val)

{

  var v = getCell(row, col);

  v.innerHTML = val;

  v.className = “cell”;

}
function getValue(row,col)

{

//  alert(row + “,” + col);

  var v = getCell(row, col);

  return v.innerHTML;

}

function setHole(row,col)

{

  var v = getCell(row, col);

  v.innerHTML = “”;

  v.className = “hole”;

  ghrow = row;

  ghcol = col;

}

function getRow(obj)

{

  var a = obj.id.split(“_”);

  return a[1];

}
function getCol(obj)

{

  var a = obj.id.split(“_”);

  return a[2];

}
function isHole(row, col)

{

  return (row==ghrow && col==ghcol) ? true : false;

}

function getHoleInRow(row)

{

  var i;
  return (row==ghrow) ? ghcol : -1;

}

function getHoleInCol(col)

{

  var i;

  return (col==ghcol) ? ghrow : -1;

}

function shiftHoleRow(src,dest,row)

{

  var i;

  //conversion to integer needed in some cases!

  src = parseInt(src);

  dest = parseInt(dest);

  if (src < dest)

  {

    for (i=src;i<dest;i++)

    {

      setValue(row,i,getValue(row,i+1));

      setHole(row,i+1);

    }

  }

  if (dest < src)

  {

    for (i=src;i>dest;i–)

    {

      setValue(row,i,getValue(row,i-1));

      setHole(row,i-1);

    }

  }

}

function shiftHoleCol(src,dest,col)

{

  var i;

    //conversion to integer needed in some cases!

  src = parseInt(src);

  dest = parseInt(dest);

      if (src < dest)

  {//alert(“src=” + src +” dest=” + dest + ” col=” + col);

    for (i=src;i<dest;i++)

    {//alert(parseInt(i)+1);

      setValue(i,col,getValue(i+1,col));

      setHole(i+1,col);

    }

  }

  if (dest < src)

  {

    for (i=src;i>dest;i–)

    {

      setValue(i,col,getValue(i-1,col));

      setHole(i-1,col);

    }

  }

}

function move(obj)

{

  var r, c, hr, hc;

  if (gintervalid==-1 && !gshuffling)

  {

    alert(‘Please press the “Start Game” button to start.’)

    return;

  }

  r = getRow(obj);

  c = getCol(obj);

  if (isHole(r,c)) return;

  hc = getHoleInRow(r);

  if (hc != -1)

  {

    shiftHoleRow(hc,c,r);

    gmoves++;

    checkWin();

    return;

  }

  hr = getHoleInCol(c);

  if (hr != -1)

  {

    shiftHoleCol(hr,r,c);

    gmoves++;

    checkWin();

    return;

  }

}

function shuffle()

{

  var t,i,j,s,frac;
  gshuffling =  true;

  frac = 100.0/(gsize*(gsize+10));

  s = “% “;

  for (i=0;i<gsize;i++)

  {

    s += “|”;

    for (j=0;j<gsize+10;j++)

    { 

      window.status = “Loading ” + Math.round((i*(gsize+10) + j)*frac) + s 

      if (j%2==0)

      {

        t = r0(gsize);

        while (t == ghrow) t = r0(gsize); //skip holes

        getCell(t,ghcol).click();

      }

      else

      {

        t = r0(gsize);

        while (t == ghcol) t = r0(gsize); //skip holes

        getCell(ghrow,t).click();

      }

    }

  }

  window.status = “”;

  gshuffling = false;

}

function loadBoard(size)

{

  gsize = size;

  board.innerHTML = showTable(gsize);

  setHole(gsize-1,gsize-1);

  //shuffle();

}

</script>

<body bgcolor=”#666655″ text=”white”>

<center>

<h1>Just Games!</h1>

<table border=6 width=”80%” cellpadding=4 cellspacing=0>

<tr><td width=”98%”><h2>Arrange</h2></td>

 <td align=center><input type=button id=butHelp value=”Hide Help” class=”but” onclick=”toggleHelp()”></td></tr>

<tr id=help><td colspan=3><h3>

<ol>

<li>Choose a Level (3 to 10).</li>

<li>The game board has blocks with numbers in it. Also there is a single “hole” that can be used for moving the blocks.</li>

<li>The objective of the game is to order the numbers using the “hole” for temporary movement.</li>

<li>Press the “Start Game” button. The timer would be started.</li>

<li>Move blocks in a row by clicking on them. A block can be moved only if it is in the same row or column as the “hole”. Make a guess by typing in a number in the box provided.</li>

<li>You can move multiple blocks (in the same row or column as the “hole”) by clicking the farthest block that you need to be moved.</li>

</ol>

Order all the numbers in the shortest time possible with a minimum number of moves…

</h3></td></tr>

</table>

<p>

<div id=test></div>

<table cellpadding=4>

<tr><td align=center>

<b>Choose Level: </B>

<select id=level onchange=”loadBoard(parseInt(level.value))”>

<option value=’3′>3</option>

<option value=’4′ selected>4</option>

<script>

for (var i=5;i<=10;i++)

{

  document.write(“<option value='” + i + “‘>” + i + “</option>”);

}

</script>

</select>

</td></tr>

<tr><td align=center>

<input type=button class=but value=”Start Game” onclick=”startGame();”>

<tr><td align=center id=fldStatus class=capt2>

</td></tr>

</table>

<div id=board></div>

<!– Script Size:  10.06 KB –>

Posted in 2. Games | Leave a Comment »