(No Subject)

new topic     » goto parent     » topic index » view thread      » older message » newer message

I posted some code yesterday to graphically display the results of rand(). Well
here is the tested code made into a nice little screen saver.
The code I sent yesterday should have used mode 18 not mode 19.
From watching the screen saver a whil you notice
the longer it has to just call rand(640) the more spread the data becomes.
Anyway just watch it for a while. Leave it running for at least 5 minutes to see
it make the picture interesting.

-----< Snip > -----
include graphics.e

sequence reps
         reps = repeat(0,640)
integer i, clr, until
object x

-- if graphics_mode(18) = 0 then -- 16 Colour
if graphics_mode(257) = 0 then -- 256 Colour

    --clr = rand(16) - 1 -- 16 Colour
    clr = rand(256) - 1 -- 256 Colour
    x = palette(clr,
            {rand(16),rand(16),rand(16)} * 4 - 1 )
    until = rand(432) + 48
    while get_key() = -1 do
        i = rand(640)
        reps[i] = reps[i] + 1
        if reps[i] = until + 1 then
            reps = repeat(0,640)
            reps[i] = 1
            --clr = rand(256) - 1 -- 16 Colour
            clr = rand(256) - 1 -- 256 Colour
            x = palette(clr,
                    {rand(16),rand(16),
                     rand(16)} * 4 - 1 )
            until = rand(432) + 48
        end if
        pixel(clr, {i-1,480-reps[i]} )
    end while
end if
----<End Snip>-----
-----
Sincerely,
Mathew Hounsell
Mat.Hounsell at Mailexcite.Com




Free web-based email, Forever, From anywhere!
http://www.mailexcite.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu