This post introduces three fundamental programming constructs.
Programming languages allow us to be lazy and DBN is no exception. The basic idea to reduce the size of the program from the previous post is to abstract the algorithm’s steps into a new DBN command. The name of the command will reflect what the algorithm produces. The way to do it in DBN [...]
Let us recap the steps we took in the previous post to produce a centred square:
We choose the left coordinate of our square, e.g. left = 20.
We know that the left bottom vertex of a centred square is on the main diagonal and hence bottom = left.
By definition, the left and right sides are equally [...]
In DBN, the canvas for our artistic output is a virtual square sheet of paper, 101 points wide, with the lower bottom point having coordinates [0 0] and the top right point having coordinates [100 100]. The DBN command
line X1 Y2 X2 Y2
draws a straight line from endpoint [X1 Y1] to endpoint [X2 Y2]. For [...]
To execute DBN programs we need the DBN programming environment, available on the DBN website. It can be downloaded and executed on various platforms because it is written in Java. Even more simply, the environment can be run directly from the website as a Java applet, within a web browser. I use the applet instead [...]
DBN (Design by Numbers) is a very simple language to program small, non-trivial, interactive, and animated computer art works. DBN can also be used as a language to introduce fundamental computing concepts (like variable, iteration, selection) because the immediate visual feedback obtained by executing a DBN program helps one to understand the program’s instructions [...]