Terrain Generation / Displaying terrain

Well I've pretty much got this figured out now I think except in this tutorial I'm following the author leaves out a vital detail;
For the Triangle class, he leaves out the variable 'STEPS' (int triangleCount = (steps * steps * 2)
and this is for generating fractal terrain

The sample code works in squares.
If you have a grid of 4 by 4 quads (steps = 4)(16 quads in total).
Each quad is made out of 2 triangles (32 triangle in total).
So this is 4 * 4 * 2.
The code let i vary from 0 to steps, and for every i vary j from 0 to steps.
For every state there are 2 triangles created.
The region is filled from bottom up and left to right.

The sample code works in squares.
If you have a grid of 4 by 4 quads (steps = 4)(16 quads in total).
Each quad is made out of 2 triangles (32 triangle in total).
So this is 4 * 4 * 2.
The code let i vary from 0 to steps, and for every i vary j from 0 to steps.
For every state there are 2 triangles created.
The region is filled from bottom up and left to right.

I need to GET the number of quads, I'm generating this terrain so I don't know how many there are

The steps is something that depends on the source of the terrain data and the detail level that you want for your terrain.

For instance if you use a heightmap as source for you terrain, then the number of pixels can be used as your steps value.
If you are using a 256 x 256 bitmap to create the heights then your step can be 256.
But you can also use 128, then the resolution of your terrain is divided by 2, so your detail level is lower.

If you are using external data to create the heights then you decide what your input is.
Example:
If a height data is available for every meter and you want a terrain of 100 x 100m
Then you can use 100 as step value: then for every meter you use a new value for your height.
You can use 50 as step value: then you must assign a new value every 2 m
you can use 25 as step value :then you must assign a new value every 4m
and so on.

Conclusion:
So the "steps" in function of the size of your terrain determine the detail level.
Off course how bigger the "steps" value (more steps) how higher de detail level, how lower the performance and the more memory is used.