★ CODING ★ LISTINGS ★ GRAPHIC DESIGNER: APRIL FOOL (COMPUTER GAMER)) ★ |
Graphic Designer: April Fool (Computer Gamer) | Coding Listings |
Do you have the artistic ability of a cockroach? This program for Beeb or Amstrad does the work for you. With the expanding sophistication of the graphics available on modern home microcomputers, there's been an explosion in the range of graphic designer programs, both commercial and in the form of magazine listings. Unfortunately they all rely on the user having some degree of artistic talent in order to produce anything worth the label “art”. So I decided to see what could be done for those with creative desire but no ability. In a sense it would be very easy to write a program which produced any desired picture (within the limits of the chosen computer's graphics system, that is) Any screen picture consists of a finite number of pixels, each set to one of a finite number of colours. In theory, then, you could write a program which simply worked its way through every possible combination of coloured pixels, stopping It when you saw something you liked. Like the proverbial infinite number of monkeys with typewriters, this would produce a multitude of masterpieces but take so long (even changing one pixel every microsecond), that you and your computer would be long dead before getting a worthwhile result. Luckily we can used advanced probability theory to greatly reduce the time needed to generate a meaningful display. And surprisingly, the necessary program can be quite short. The trick depends on 'seeding' the graphics screen with some random-looking data which is actually tailored to vastly increase the probability that a pseudorandom set of changes (such as those made using the built-in RND function of a home micro) will result in a picture. The theory is far too complex to discuss here but is based on work published in the mid-seventies by Hugh Ardmon (Scientific American. April 1975, Pixels, Probability and Pseudo-randomness' page 41) Two versions of a simple generator are given, for the BBC Micro and the Amstrad CPC464. Each works in Mode 1 (medium resolution and four-colour). but only displays in two colours to make the probability equations more manageable. Each program does a little initialization of the graphics system before seeding the screen and . entering a loop which uses RND to plot pixels psuedo-randomly. To keep the program size down, all the seeding data is generated from the computer's ROM using a relatively small set of random numbers. The DATA statements were arrived at after much calculation and experiment and MUST NOT be altered for the programs to work correctly. When run, the programs take a fair time to set up. but be patient. The user Is prompted to seed the micro's random number generator, giving you some control over the result. Once the program starts plotting points, you should see some kind of image forming within 20-30 seconds. Several minutes later you should get the optimum effect. Pressing a key once freezes the action while you set up the tape, pressing Return then saves the screen to tape or disc.
|