CODINGLISTINGS ★ LANDSCAPES ★

LandscapesCoding Listings
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

Brian James concludes his scenic art program for the Amstrad.

This MONTH we look further into the nature of probability which is the key concept in these programs for the Spectrum and Amstrad computers which generate landscape scenes spontaneously. Such a program first needs some basic knowledge about the subject to be portrayed. This knowledge is described by mathematical relationships. Some of these relationships are rigid ones — for example, solid features will hide the view behind them. Other relationships are not precisely defined; for example the slope of a mountainside may have almost any gradient, though very steep slopes occur only occasionally.

The program must be allowed freedom of choice wherever possible, but must not be allowed to do unusual things too often. That is — suitable probability functions must be used.

Listing 1 is a simple Basic program to demonstrate some probability distributions. The function RND returns a value between 0 and 1, with no bias. Therefore the combination

x = a + RND *b

gives a “flat” distribution — that is, equal probability of any value between the lower limit la) and the upper limit (a + b). Now we can combine the RND functions in different ways to produce more subtle distributions. Suppose we put

x = a + (RND + RND + RND + RND)/4 * b

This gives a hump-shaped distribution — a crude approximation to the famous “Normal” distribution. The values of x will tend to cluster around the middle with smaller probability of extreme values. Now consider

x = a * RND ↑ 2

This will cause a skewed distribution, with small values of x having much greater probability than large values. A greater skew will be obtained from the function

x = a* RND ↑ 4

and so on. It is important to realise that RND is different every time it is used — therefore

RND + RND is NOT equal to 2 * RND

Listing 2 is a very entertaining program using two-dimensional distributions to produce a multicoloured pulsating galaxy. The same distribution can be used for a cluster of leaves, daisies etc.

These programs are in Basic, which is very easy to enter and very easy to experiment with. The Landscape Utility itself has been written in pure machine code, because of the sheer number of calculations which have to be done. Each new landscape is created in about 8-20 seconds.

Suitable probability distributions can create surprisingly realistic mountain skylines. The slope must take values which are not too steep too often, not too straight, and not showing a regular pattern. There are big bumps and small bumps and even smaller bumps . . . The mathematical functions called fractals have this property of having an endless succession of smaller end smaller wiggles, in fact going on and on, to the infinitely small.

They have been used to create mountain scenery with remarkable realism by Lucasfilm, using very expensive high-resolution equipment. However, true fractals are purely mathematical abstractions .. . they have an infinite length, because of the infinite number of wiggles on an ever-decreasing scale of size, and therefore cannot actually be shown on any video screen! However my own functions are not unrelated to fractals,, since they use two different magnitudes of wiggliness.

There is a problem with the random number generators in the home computer. They are not truly random; they are “pseudorandom". This mcans each number is not actually independent. You will eventually come back to the same sequence and go round in a tig cycle. Also patterns can sometimes be found if you plot a random scatter of points.

What should we call this kind of ant? I suggest the terms “artistic algorithms” or “computer creativity”. The simplest kind of program, which draws diagonal lines at random polygons, could be said to be “random art”.

YourComputer8506

★ PUBLISHER: Your Computer
★ YEAR: 1985
★ CONFIG: 64K + AMSDOS + ALL CRTC
★ LANGUAGE:
★ AUTHOR: Brian James

 

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» Landscapes    (Your  Computer)    LISTING    ENGLISHDATE: 2019-12-08
DL: 180
TYPE: PDF
SiZE: 308Ko
NOTE: 2 pages/PDFlib v1.6

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Coding Src's » Circle of Triangles (Computing with the Amstrad)
» Coding Src's » Spirograph (Computing with the Amstrad)
» Coding Src's » Vektorschrift
» Coding Src's » Eye
» Coding Src's » Skulls (Amstrad Computer User)
» Coding Src's » Graphic - Pattern Plotter
Je participe au site:
» Pour ce titre nous ne disposons de fichier executable sur CPC (Dump, Saisie du listing) , alors si vous avez ça dans vos cartons ou vous désirez usé vos petit doigts boudinés sur votre clavier faites le nous savoir.
» Vous avez des infos personnel ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 352 millisecondes et consultée 865 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.