';
document.getElementById("IdLbl_BlkImgTbl").innerHTML = StrWr_BlkImg_Table(numPuzRows,numPuzCols);
targetWord_Pos2D = AllocArray2D(); //Initilized with a Space
targetWord_Pos2D_Ex = AllocArray2D(); //Initilized with a Space
NextWord(1);
}
function OnReport()
{
var searchedWordRowIdx = new Array(); //Row Position of Answer Key
var searchedWordColIdx = new Array(); //Col Position of Answer Key
var EndAt = (countAllTargetWord - countReportingWord);
if(EndAt <= 0)
return;
else if(EndAt > numPuzRows)
EndAt = numPuzRows ;
for(m=0;m 0)
document.getElementById("Btn_Report").value = "Report " + countReportingWord + "->";
else //the Last Screen -- Fill the rest rows with White Blank
{
for(m=EndAt;m 0) //other than horizontally
{
if(strSrchWord.length > numPuzRows) //no chance to fit it
return 0;
}
else //horizontally
{
if(strSrchWord.length > numPuzCols) //no chance to fit it
return 0;
}
//document.getElementById("LblInput").innerHTML = "<"+WordPosRow+","+WordPosCol+">"; //testing
for(k = 0; k < strSrchWord.length; k++)
{
curChar = strSrchWord.charAt(k);
switch(idxWordPosDirection)
{
case 0: //horizontally
countWhileLoops = 0;
while(k == 0 && WordPosCol+strSrchWord.length > numPuzCols && countWhileLoops < maxWhileLoops)
{
WordPosCol = Math.floor(Math.random()*WordPosCol_UpLimit);
countWhileLoops = countWhileLoops + 1;
}
if(WordPosCol <= numPuzCols)
{
pic_idx_row = WordPosRow;
pic_idx_col = WordPosCol;
WordPosCol = WordPosCol + 1;
}
else
return 0; //Failed!
break;
case 1: //Vertically
countWhileLoops = 0;
while(k == 0 && WordPosRow+strSrchWord.length > numPuzRows && countWhileLoops < maxWhileLoops)
{
WordPosRow = Math.floor(Math.random()*WordPosRow_UpLimit);
countWhileLoops = countWhileLoops + 1;
}
if(WordPosRow <= numPuzRows)
{
pic_idx_row = WordPosRow;
pic_idx_col = WordPosCol;
WordPosRow = WordPosRow + 1;
}
else
return 0; //Failed!
break;
case 2: //Diagonally: from Top-Left to Bottom-Right
countWhileLoops = 0;
while(k == 0 && WordPosCol+strSrchWord.length > numPuzCols && countWhileLoops < maxWhileLoops)
{
WordPosCol = Math.floor(Math.random()*WordPosCol_UpLimit);
countWhileLoops = countWhileLoops + 1;
}
countWhileLoops = 0;
while(k == 0 && WordPosRow+strSrchWord.length > numPuzRows && countWhileLoops < maxWhileLoops)
{
WordPosRow = Math.floor(Math.random()*WordPosRow_UpLimit);
countWhileLoops = countWhileLoops + 1;
}
if(WordPosCol <= numPuzCols && WordPosRow <= numPuzRows)
{
pic_idx_row = WordPosRow;
pic_idx_col = WordPosCol;
WordPosCol = WordPosCol + 1;
WordPosRow = WordPosRow + 1;
}
else
return 0; //Failed!
break;
case 3: //Diagonally: from Bottom-Left to Top-Right
case 4: //Diagonally: from Bottom-Left to Top-Right
countWhileLoops = 0;
while(k == 0 && WordPosCol+strSrchWord.length > numPuzCols && countWhileLoops < maxWhileLoops)
{
WordPosCol = Math.floor(Math.random()*WordPosCol_UpLimit);
countWhileLoops = countWhileLoops + 1;
}
countWhileLoops = 0;
while(k == 0 && WordPosRow-strSrchWord.length < 0 && countWhileLoops < maxWhileLoops)
{
WordPosRow = Math.floor(Math.random()*WordPosRow_UpLimit);
countWhileLoops = countWhileLoops + 1;
}
if(WordPosCol <= numPuzCols && WordPosRow >= 0)
{
pic_idx_row = WordPosRow;
pic_idx_col = WordPosCol;
WordPosCol = WordPosCol + 1;
WordPosRow = WordPosRow - 1;
}
else
return 0; //Failed!
break;
default:
break;
} //switch(idxWordPosDirection)
//by calling ShowAllWords()
if(targetWord_Pos2D[pic_idx_row][pic_idx_col] == " ") //if Empty
targetWord_Pos2D[pic_idx_row][pic_idx_col] = curChar;
else //Not empty
{
if(targetWord_Pos2D[pic_idx_row][pic_idx_col].toUpperCase() != curChar.toUpperCase()) //Not empty and Not the same char
return 0; //Failed!
}
} //for(k = 0; k < strSrchWord.length; k++)
return 1; //Succeed!
}
function OnLetterClick()
{
var loc;
if (event.button == 1)
{
loc = event.srcElement.name;
if(loc == null || loc == "")
{
return;
}
var curImgBlkFullName = new String(document.images[loc].src);
var curImgBlkFn = curImgBlkFullName.substring(curImgBlkFullName.lastIndexOf("/")+1,curImgBlkFullName.length);
var curImgBlkFullDir = curImgBlkFullName.substring(0,curImgBlkFullName.lastIndexOf("/"));
var curImgBlkSubDir = curImgBlkFullDir.substring(curImgBlkFullDir.lastIndexOf("/")+1,curImgBlkFullDir.length) + "/"; //end with '/'
//alert(curImgBlkSubDir);
var loc_3parts = loc.split("_"); // 3 parts: pic_rowIdx_colIdx
if(curImgBlkSubDir == fnImgBase_Blue || curImgBlkSubDir == fnImgBase_Green)
{
document.images[loc].src = fnImgBase_Red + curImgBlkFn; //User's Input
ClickedLetterRowIdx[inputWord.length] = Number(loc_3parts[1]); //pic_rowIdx_colIdx
ClickedLetterColIdx[inputWord.length] = Number(loc_3parts[2]);
inputWord = inputWord.concat(curImgBlkFn.charAt(0));
}
if(curImgBlkSubDir == fnImgBase_Red)
{
document.images[loc].src = fnImgBase_Blue + curImgBlkFn; //User's Change
inputWord = inputWord.slice(0,inputWord.length-1);
}
countClicks = countClicks + 1;
document.getElementById("LblCountClicks").innerHTML = countShowWhereClicked + "|" + countClicks;
document.getElementById("LblInput").innerHTML = "("+inputWord.toLowerCase()+")";
for(n=0; n\n');
for(i=0; i\n');
for(j=0; j\n');
}
document.write('\n');
}
document.write('\n');
}
function StrWr_BlkImg_Table(dimPuzRows, dimPuzCols) //Write HTML into a String
{
var strHTML_BlkImg_Table = "";
//191+fix(rand(1)*64), 63+fix(rand(1)*192), 127+fix(rand(1)*128);
var redClrIdx = Math.floor(Math.random()*8)+7; //7~15
var greenClrIdx = Math.floor(Math.random()*9); //0~9
var blueClrIdx = Math.floor(Math.random()*8)+7; //7~15
var strRidgeColor = "";
if(redClrIdx <= 9)
strRidgeColor = String(redClrIdx) + "0";
else
{
strRidgeColor = letterABC[redClrIdx-10] + "0";;
}
strRidgeColor = strRidgeColor.concat(String(greenClrIdx)+"0");
if(blueClrIdx <= 9)
strRidgeColor = strRidgeColor.concat(String(blueClrIdx)+"0");
else
{
strRidgeColor = strRidgeColor.concat(letterABC[blueClrIdx-10]+"0");
}
strHTML_BlkImg_Table = '';
for(i=0; i');
for(j=0; j');
}
strHTML_BlkImg_Table = strHTML_BlkImg_Table.concat('');
}
strHTML_BlkImg_Table = strHTML_BlkImg_Table.concat('
');
return strHTML_BlkImg_Table;
}
document.onmousedown = OnLetterClick;
// -->
Input: |
#Show|#Click: |
#Success/#Word: |
Target: |