previous

page 9

next

If all went well you should have ended up with 854 sets.
I know it's frustrating when all you get is a blank screen when you have made a mistake. If you can't find it, perhaps copy & paste my code into the appropriate places.

Have a good look at the words. Notice how the same words are often repeated - this will make for a very boring game. I found by simply shuffling the my_words4 array, I got a much more satisfying result. Here is my Shuffle function from Project 1.

    function Shuffle(array) {
      var i,j,temp;
      for (i=array.length-1; i>0; i-=1) {
        j=Math.floor(Math.random()*(i+1));
        temp=array[i]; array[i]=array[j];
        array[j]=temp;
      }
    }

All that remains to do is to format the output properly - see below.

var s="['"+w1+"','"+w2+"','"+w3+"','"+w4+"'],<br>";

You'd be well advised to copy & paste this line into make_word4_sets.html - I've checked it but it was a nightmare to get right. When you're sure your output looks ok, copy & paste the screen into a new file called word4_sets.js and edit it so that the top and bottom are like mine.
You should end up with about 1,000 sets.

var word4_sets=[
['GOLF','GRIT','FUEL','TEAL'],
...
['BAGS','BRAN','SURE','NOSE']
];
previous
next