CHAPTER 6
Code Explanation
var inbetween = 300; Variable holding the distance between the original two
columns
var col1 = 20; Variable holding the horizontal position of the first column
var row1 = 200; Variable holding the vertical position of the first row
var rowsize = 50; Variable holding the height of a row (the block itself and
the spacing) for creation of all the rows
var slots = new Array(nq); An array variable to hold which slots in the right column
have been filled
function init(){ Start of init function
setupgame(); Invoked setupgame();
} Close of init function
function setupgame() { Start of setupgame function
var i; Variable used for the for loops
var c; Variable used for the choice of row (inner array) of facts
var s; Variable used for choice of slots
var mx = col1; Variable holding the horizontal position
var my = row1; Variable holding the initial vertical position
var d; Variable ho ldi ng the created html element
var uniqueid; Variable ho ldi ng the created id
for (i=0;i<facts.length;i++) { Start of a for loop to mark all facts as not being used
facts[i][2] = false; Set (reset) the third value, index 2, to be false
} Close the for loop
for (i=0;i<nq;i++) { Start of a for loop to set all the slots to unused