|
Hidden features in DBN need more speed
with dbn 3.0, a slow-down feature has been re-added that had been
missing since the original version (1.0). the slower-running dbn
is better for seeing how things like repeat work, because one can
can watch instances of a repeat being handled invidually. however, some
may outgrow things being so slow. those people, when they're
ready, can write fast at the beginning of their program.
because, that's how you make a program fast. this tells dbn to make
your program fast. no, i'm not joking.
when your dbn program is running, the interpreter uses patented ai-refresh(tm) technology to guess when the dbn window should be updated. but like most AI, it isn't (and can't be) perfect. so the discriminating programmer (the anal retentive designer), often finds that their program is flickering way too much. the solution is to put refresh in your program wherever you want the screen updated. the dbn parser, seeing that refresh has been used, will no longer update automatically, but only on your command. it will instead wait until your program calls refresh to show your changes in the drawing area. norefresh forever { paper <mouse 1> pen <mouse 2> line 30 30 <mouse 1> <mouse 2> refresh // update the screen }saving dbn images by holding down the 'control' key, and clicking inside the dbn image area, you can save the current image to disk as a tiff file. dbn doesn't support arrays, which makes some programmers very sad. in a moment of weakness, the maintainer of dbn succumbed to these whiners and added an extra connector, called array. this array has 1000 elements, which you may get and set to your heart's content. // a boring example to show syntax set <array 1> 30 set <array 2> 80 set <array 1000> 40 paper <array 1000> // draw a line from 40, 40 to 30, 80 line 40 40 <array 1> <array 2>pause pause is the german word for 'recess' (pronounced pow-zuh). pause 5 // wait for 5 hundredths of a second pause 200 // wait for 2 secondsmodulo this and that modulo, the % sign, is a math operator that gives you the remainder of a division between two numbers. // sets a to the remainder of 11 divided by 2 set a (11 % 2)the magical line number buffer after running a program,
hold down the shift key while dragging the mouse to and fro inside the
dbn graphics area. as you drag over each pixel, the dbn editor highlight
the line that was last to draw that pixel. ooh ahh! useful in understanding
how dbn programs work.
i may as well
tell you that this version includes color. this is just a
for-fun basis, and we only rarely use it, because it's not part
of the 'real' dbn language. but in case you're curious, it's there.
and while on the topic of unsanctioned dbn features, now is a good
time to mention that
the drawing area can be resized, using the 'size' command. 'size 200
200' in your code will cause the drawing window to grow to 200 by
200 pixels (instead of the usual 101 by 101).
|
Design By Numbers
is Copyright 1999-2001, Massachusetts Institute of Technology. |