Pseudocode is a simple way of working through the logic behind any programme without using a specific programming language.
This is the initial pseudocode from 1998 for the artwork cubeLife, which was used to develop in Java with programmer Greg Turner.
Single line comments within the code are prefixed by //
Multi-line comments are sandwiched between /*
and */
This pseudocode was still under construction when we began to develop directly in Java.
______________________________________________ General notes: The first time a handler is called, the comment reads: //see handler for definition after which, any subsequent reference is commented: //defined This code is for one of a possible n number of cubes. ================================================ enterSpace /* when someone enters the space: new variable: inputDevice to store location of 1 of n input devices chosen by user row of n pulse detector devices, type to be determined. A separate IR beam movement detector or similar triggers this initial handler. */ on enterSpace if finger is placed in detector then //means of detection to be determined takePulse //see takePulse for definition put input device number into inputDevice else write message "Please place finger in detector" end if end enterSpace ______________________________________________ takePulse /* Called in enterSpace if finger placed in pulse detector new variables: pulseCount stores number of pulse beats pulsePeriod stores number of seconds from first pulse beat until finger withdrawn for multi-input handling use: pulseCount(inputDevice) pulsePeriod(inputDevice) call variable: inputDevice =n (input device number) from enterSpace */ on takePulse //called when finger placed in input device if pulse detected then //take pulse for 2 beats before anything shows for each pulse beat detected put 1 into pulseCount start timer counting in seconds // stops in freecube or growCube put the seconds into pulsePeriod //starting from the first pulse if pulseCount =3 then growCube //see growCube for definition end if else // in case pulse not detected or fails after 1-2 pulses taken write message "Pulse not detected" at location inputDevice //alternative=build vertex-only (dots) order 3 cube then fade stop timer put 0 into pulseCount put 0 into pulsePeriod end if end takePulse ______________________________________________ growCube /* Draw an order 3 cube then grow while finger still in input device. Called in takePulse when pulseCount reaches 3. call variables: pulseCount =3 and still counting from takePulse inputDevice =n (input device number) from enterSpace +(pulsePeriod =still incrementing seconds elapsed so far from takePulse) * / on growCube if finger still in input device then test //not sure about this method - need something that will watch incrementation of pulsecount case pulseCount >2 and <12 if pulseCount/2 is an integer then draw cube(pulseCount/2) at location inputDevice end if case pulseCount >28 and <32 draw cube(pulseCount/2) at location inputDevice write "it's time to let your cube go..." case pulseCount >31 and <38 write "let this cube go, or it will shrink" at location inputDevice stretchCube //see stretchCube for definition case pulseCount >37 and <41 write "after three seconds your cube will diminish." at location inputDevice wait 3 seconds shrinkCube //see shrinkCube for definition else //when finger removed stop timer reset timer to 0 //now stored in pulsePeriod freeCube //see freeCube for definition end if end growCube ______________________________________________ freeCube /* Called in growCube when finger withdrawn from input device new variable: pulseSpeed = pulsePeriod/pulseCount to give heart rate storePeriod = replaces pulsePeriod to store data for one cube at end of freeCube call variables: pulseCount =>3 from growCube pulsePeriod = (seconds elapsed until 3rd pulse) from takePulse through growCube inputDevice = n (input device number) from enterSpace */ on freeCube if pulseCount =3 then write message "It takes more than 3 heartbeats to make a cube" //alternative=build order 3 cube then collapse or fade put 0 into pulsePeriod put 0 into pulseCount put 0 into inputDevice else write message "This is your cube, it has taken &&pulseCount&& of your pulses and &&pulsePeriod&& seconds to build" at location inputDevice //calculate heart rate for driftCube then clear variables put pulsePeriod/pulseCount into pulseSpeed put pulsePeriod into storePeriod put 0 into pulsePeriod put 0 into pulseCount put 0 into inputDevice driftCube //see driftCube for definition end if end freeCube //-- OKAY TO HERE - THE FOLLOWING NEVER USED -- ______________________________________________ driftCube /* Called in freeCube after finger removed from input device variables: pulseSpeed =heart rate from freeCube inputDevice =n (input device number) from enterSpace storePeriod =the time taken to build this cube */ on driftCube //determine overall XYZ vector for direction of movement X=<???> //use inputDevice to determine rough direction Y=<???> //use heartbeat data to determine other movements Z=<???> //give cube a finite life (will need to tinker with this duration) repeat for pulseSpeed^2 minutes //jiggle XYZ positions add <random within limit> to X vector add <random within limit> to Y vector add <random within limit> to Z vector //move cube in 3D space depending on heartbeat rate move cube (pulseSpeed*<distance tbc>XYZ) every pulseSpeed seconds wait pulseSpeed seconds end repeat if this cube meets another cube mergecube end if end driftCube ______________________________________________ mergeCube //When two drifting cubes meet on mergeCube get the order of cube1 and cube2 get the life remaining of cube1 and cube2 get the direction of cube1 and cube2 //instructions for cube interaction based on numeric structures end mergeCube ______________________________________________ stretchCube /* to be developed */ on stretchCube //instructions for cube growth based on input data end stretchCube ______________________________________________ shrinkCube /* to be developed */ on shrinkCube //instructions based on input data end shrinkCube ______________________________________________ //further instructions under development