Re: A Little QBasic help

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

Doug Cox wondered about converting aQBasic program.

Here's a go at it. I didn't test it, though. Note that the you have to add 1
to all the indexes, since Euphoria does not support indexes starting at
zero.

--- untested code ---

constant anzbee = 100

sequence g, p, pa, pa2

for a = 0 to anzbee do


    g = append( g, { rand(7)-3, rand(7)-3 } )
    p = append( p, { rand(640), rand(480) } )
    pa = append( pa, { rand( 640 ), rand( 480 ) } )
    pa2 = append( pa2, { 0, 0 } )


end for

if graphics_mode( 12 ) then
    puts( 1, "Unable to set screen mode\n" )
    abort(0)
end if


g[1,1] = remainder( (g[1,1] + rand(2)-1), 10 )

-- end untested code

 the arguments to remainder might be backwards, and you might need to
subtract 1 from the random number equation, too.

Some people might prefer initializing the arrays as:

    g = repeat( { 0, 0 }, anzbee )

or

    g = repeat( repeat( 0, 2 ), anzbee )

-- David Cuny

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

Search



Quick Links

User menu

Not signed in.

Misc Menu