Weeks 9 - 11
New stuff for next week:
random numbers, (teleology, mechanism and pragmatism) and evaluating a random number generator
Remember that Assignment #5 is due Wednesday the 19th
something I'll talk about on Monday
Form elements review
Conditionals:
Here's a place to try things out.
Loops:
Make your script determine when the puzzle has been solved. That is: whenever the picture is reassembled by the user (that is, all six pieces are adjacent to one another in the order they were originally in your picture):
Here's a little something which might help with swapping.
Issues:
<span onclick="f(7)"><img src="pic7.jpg"></span>
function f(x){document.images[x].src="new.jpg"}
See strategies, below.
while (i++<numberofimages){document.images[i].src="new.jpg"}
a. document.images[1].src="pic5.jpg"; document.images[2].src="pic3.jpg"; document.images[3].src="pic6.jpg"; etc.
or
b.
A=new Array(5,3,6,2,1,7,4);
while (i++<numberofimages){document.images[i].src="pic"+A[i]+"jpg"}
1. Load images in "solved" order first then determine resolved file addresses
2. Use string manipulation to pull off only the relevant characters
3. Remember which image is where through an array