Kids getting their own games out of f3: this is kidpop06, more advanced sorting with arrays -- using QSORT2 ***Adults: you will find instructive programs and occasionally useful comments inside the KIDPOPnn series, where bits and pieces not discussed in F3DOCS are shown. So it has value for you, too! Written by Aristo ***HI KIDS!!! Perhaps you have already got to know a little bit of what arrays are, and what it is to sort them by what we can call "doing bubbles", in Lisa GJ2 Fic3. When we did the bubbles, whether they floated left or right or up or whatever, it was all about looking again and again at two and two and there's a much faster way for the PC to do. It is also about looking at two and two at a time, but rather than going again and again through the list from one side to the other, it handles it by bunches. These bunches are sorted into each other. This is technically not interesting to understand. But it is good to know how to do it. Here's how to do it for ten numbers -- and by changing the number 10 to a 1000 you can get it do work on a thousand numbers just as easily. Since it is so few lines, and since it is all about text, not graphics, why not type in these lines, and you'll get something on the screen which are not quite these numbers but other numbers between 1 and 100. Just watch here: this is a photograph of the screen, I just typed it in: So that's all there is to it. The idea here is that you can use QSORT2 without changing the array, by having a kind of map into it, -- another array. And so you sort the map instead of the main array, right? And then, to see the sorted result, you use SEEBYINDEX, for we call this map for an 'index'. That's just a computer term, it means just a map. So QSORT2 wants you to give two numbers to it -- we call these numbers also "warps", for fun -- and these two numbers in this case we store them in N1 and N2. So N1 is any of these numbers from 1 to 100, ten of them in this case. While N2 is the index. So N1 N2 QSORT2 -- or, when inside a program, you could write it nicely by (( N1 ; N2 => QSORT2 )) -- anyway, this type of thing changes N2, the index. And so when you write SEEBYINDEX you get to see how the index has changed, while the original array N1 is left intact. Now if you have a lot of other information tied up to the numbers -- perhaps they are names of treasures, how many of these treasures in a game -- and you want to have them sorted, perhaps because it makes the game easier to program, then you can do it by QSORT2. There is more about it in the manual, which is a big big big text we call F3DOCS, and NAMESORT is a translations so you can also sorting texts. And another way of using the same type of QSORT2 or 'sort-by-bunches' is used inside LIGHT3D, which is the name of the stuff we use when we make a certain type of very advanced games.