Problem/ Title/ Code


Still Images

 

2C Passages in Modern Sculpture 

Using DBN, create an image in the cubist spirit of "The Guitar" (p. 51). You should use at least 5 'command' definitions. 

 

"fingers play the piano"

 

command hand a b
{
line 0 a 100 b
line b 0 a 100
}

command keys k e y s
{
repeat a k e
{
pen 15
line a y a s
}
}

command bkey b k e y
{
repeat a b k
{
pen 100
line a e a y
}
}

command staff g
{
repeat a 0 100
{
set [a g] a
}
}

command note n o t e
{
repeat a n o
{
line (a) (t+a) (a) (e+a)
}
}

paper 100
pen 0

//hands play the music.
repeat r 0 5
{
hand (r) (100-r*10)
}

//hands play on the piano keys.
keys 60 90 20 35
keys 60 90 40 55
keys 60 90 60 75
bkey 75 90 47 54
bkey 75 90 67 74

//the notes and staff are from the music sheet.
//they have fallen from the piano.
repeat r 1 5
{
staff (50+r*3)
}
pen 0
note 20 25 40 50
note 30 35 20 30
note 50 55 30 40

//end music.


 

3A Visualize a geometric progression (GP) of your choice in a concrete manner that emphasizes the wide range of scales inherent to a GP. 

 

"gp radius"

 

antialias 100
load dbngraphics.dbn
forever
{
repeat a 0 100
{
repeat b 0 100
{
set [a b] (((a-32)*(a-32)+(b-32)*(b-32))/20)
}
}
circle 32 32 4 64
circle 32 32 8 32
circle 32 32 16 16
circle 32 32 32 8
circle 32 32 64 4
}


 

3C Evoke the image of an 'egg' shape: smooth, round, yet notentirely symmetrical, using all the DBN knowledge you might have at your disposal.Think closely about how the surface of the egg should be textured and decorated.

 

"Jet Stream Egg"

//negative definition of egg
repeat a 0 100
{
repeat b 0 100
{
set [a b] (a*b)
}
}

//Jet Stream around egg
repeat a 0 100
{
repeat b 0 100
{
set [(a*a/(b*10)) (a+20)] 0
}
}



4A Reinterpret one of your previous pieces as a surrealist image. Include the name of the previous assignment in your comments. 

 

"umbrella, grey day, and fishbowl in a box."

 

//Problem 2A with a surrealist twist. The viewer creates the shape of the umbrella in their mind. I have added a fish flying in the rain. The top/right corner is empty, open to imagination. A white frame creates a canvas of other-worldliness.

//Grey Day.
paper 50

//White Frame.
pen 0
repeat a 0 3
{
line 0 a 100 a
line a 0 a 100
}
repeat a 97 100
{
line 0 a 100 a
line a 0 a 100
}

set a 0
set b 100

//Uh-oh, looks like rain.
//Bring out the umbrella.
pen 100
line 60 40 80 20
line 80 20 83 15
line 83 15 81 13
line 81 13 76 15
pause 30

//Rain.
set [5 95] a
set [15 85] a
set [20 80] a
set [25 75] a
set [30 70] a
set [33 67] a

set [5 80] a
set [10 75] a
set [20 65] a
set [25 60] a
set [28 57] a
set [30 55] a
//17 rain dots.
pause 20

set [15 65] a
set [25 55] a
set [27 53] a
set [30 50] a

set [5 65] a
set [10 60] a
set [20 50] a
set [27 43] a
set [30 40] a
pause 20

set [15 95] a
set [25 85] a
set [30 80] a
set [35 75] a
set [37 73] a
pause 20

set [5 55] a
set [15 45] a
set [25 35] a
set [30 30] a
//30 dots.

set [5 45] a
set [15 35] a
set [25 25] a
set [30 20] a
set [33 17] a
set [40 10] a
set [45 5] a
pause 20

set [5 35] a
set [10 30] a
set [15 25] a
set [20 20] a
set [25 15] a
set [30 10] a
//43 rain dots.
pause 20

//50 dots.

//Flying fish.
pen 70
repeat a 20 30
{
line 20 a a 25
}



5A Using real sinusoidals, generate a shape with primarily convex properties.

 

"Night Landing"

 

#python

import math
g.paper(100)

#Wind
b = []
for i in range(0, 100):
b.append(i)
for j in range(0, 100):
g.setPixel(i, (j*2), (i*4))
if i > (j*j):
g.setPixel(i, (j*j), 0)
#Bird
for i in range(1, 50):
g.pen(i)
angle = (i/30.0) * math.pi
radius = i
x = int(60+math.cos(angle)*radius)
y = int(70+math.sin(angle)*radius)
g.line(y, x, x, 10)


 

7A Create a general method for abstractly filling the DBN paper area at variable
percentages. In a display loop, show the 25 percent, 50 percent, and 75 percent solutions in rotation.

 

"x"

 

#still image capture is at 25%

import math
g.norefresh()

def reverse(pix):
for a in range(0, 12):
if pix[a] == 0: 
pix[a] = 100
else: pass
#else: 
#if pix[a] == 100: 
#pix[a] = 0

def cross(x, y):
pix = []
xdown = [x-1, x-2, x-3]
xup = [x+1, x+2, x+3]
ydown = [y-1, y-2, y-3]
yup = [y+1, y+2, y+3]
for a in range(0, 3):
pix.append(g.getPixel(xdown[a], ydown[a]))
pix.append(g.getPixel(xdown[a], yup[a]))
pix.append(g.getPixel(xup[a], ydown[a]))
pix.append(g.getPixel(xup[a], yup[a]))
pix.append(g.getPixel(x, y))
reverse(pix)
for c in range(0, 3):
for b in range(0, 12):
g.setPixel(xdown[c], ydown[c], pix[b])
g.setPixel(xdown[c], yup[c], pix[b])
g.setPixel(xup[c], ydown[c], pix[b])
g.setPixel(xup[c], yup[c], pix[b])
g.setPixel(x, y, pix[12])

while 1:
count = 0
xcross = [] #x values for cross centers
ycross = [] #y values for cross centers

#25%
for i in range(0, 204):
xcross.append(int(i*math.sin(i)*10+20))
xcross.append(int(i*math.sin(i)+30))
ycross.append(int(i*math.cos(i)*5+25))
ycross.append(int(i*math.cos(i)+20))
cross(xcross[i], ycross[i])
g.refresh()
count = count+1
print count
g.pause(50)
#50%
xcross = []
ycross = []
for k in range(0, 408):
xcross.append(int(k*math.sin(k)*5+20))
xcross.append(int(k*math.sin(k)+50))
xcross.append(int(k*math.cos(k*2)+20))
ycross.append(int(k*math.cos(k)*5+25))
ycross.append(int(k*math.cos(k)+40))
ycross.append(int(k*math.sin(k*2)+10))
xcross.append(int(k*math.cos(k*3)+10))
ycross.append(int(k*math.cos(k/2)*5+25))
cross(xcross[k], ycross[k])
g.refresh()
count = count+1
print count
g.pause(50)

#75%
xcross = []
ycross = []
for j in range(0, 408):
xcross.append(int(j*math.sin(j*j)*5+20))
xcross.append(int(j*math.sin(j*j)+50))
ycross.append(int(j*math.cos(j)*5+70))
ycross.append(int(j*math.cos(j)+75))
xcross.append(int(j*j*math.cos(j*2)-20))
ycross.append(int(j*j*math.cos(j)*5-25))
xcross.append(int(j*math.cos(j*2)+20))
ycross.append(int(j*math.cos(j)*5+25))
cross(xcross[j], ycross[j])
g.refresh()
count = count+1
print count
g.pause(20)

g.paper(0)



8C Choose 3 of your 10 key verbs/ key adjectives from class and represent them together asa single interactive piece with no typography. No static representations allowed.
No nouns allowed. 

 

#Look on Life...


#predetermined
#on cloud nine
#straight and narrow


import math
g.norefresh()

def whitebox(pos):
g.line(5*pos, 5, 5*pos, 10)
g.line(5*pos, 5, 5*pos+5, 5)
g.line(5*pos, 10, 5*pos+5, 10)
g.line(5*pos+5, 5, 5*pos+5, 10)
c = 0
return c

def blackbox(pos):
for a in range(5*pos, 5*pos+6):
for b in range(5, 11):
g.line(a, b, a, b)
c = 1
return c

def box(x,y):
g.line(x, y, x, y+5)
g.line(x, y, x+10, y)
g.line(x, y+5, x+10, y+5)
g.line(x+10, y, x+10, y+5)

def distance (a,b,c,d):
return math.sqrt(pow(c-a, 2)+pow(d-b, 2))
c=0
x1=35
y1=0
d=30

def Circle (x, y, d):
for i in range (x, x+d):
for j in range (y, y+d):
if distance (i, j, (x+(d/2)), (y+(d/2))) < (d/2):
g.setPixel(i,j, 100)


def Mod (X, Y):
return (X-(Y*(X/Y)))

def Random (D):
A = 982621
B = 82621
C = (D*A + 1)
D = Mod(C, B)
return Mod(D, 100)

def arrow(x):
g.line(55, x, 55, x+10)
g.line(56, x, 56, x+10)

pos = 0
c = 0
while 1:
#router
for a in range(50, 62):
for b in range(2, 14):
g.line(a, b, a, b)
#determiners
#blackmaker
for a in range(20, 30):
for b in range(10,20):
g.line(a, b, a, b)
#whitemaker
g.line(30, 10, 39, 10)
g.line(39, 10, 39, 19)
g.line(39, 19, 30, 19) 
#if g.getPixel(g.getMouse(1), g.getMouse(2)) == 100:
#Cloud Nine 
box(5,60)
box(17,60)
box(30,60)
box(5,66)
box(17, 66)
box(30,66)
box(5,72)
box(17,72)
box(30,72)
gen = [] #generator
for x in range(0, 25):
gen.append(Random(x)+1)
print gen
for a in range(0, 25):
#if gen[a]%2 == 0:
whitebox(pos+1)
whitebox(pos+3)
whitebox(pos+5)
print "white"
c =0
print c
#if gen[a]%2 == 1:
blackbox(pos)
blackbox(pos+1)
blackbox(pos+4)
print "black"
c = 1
print c
pos = pos+1
print "pos+1"
if pos == 10: 
if c == 0:
#straight and narrow
g.line(55, 10, 55, 20)
g.line(56, 10, 56, 20)
for a in range(1,8):
arrow(a*10)
if c == 1:
g.line(55, 10, 55, 20)
g.line(56, 10, 56, 20)
for a in range(1,10):
arrow(a*10)
for r in range(0,10):
g.setPixel(55, a*10-r, 0)
g.setPixel(56, a*10-r, 0)
print"arrow"
g.pause(10)
g.refresh()
pos = 0

g.refresh()
g.pause(10)
g.paper(0)


 

9C Your display is now 200 by 200. Emphasize the difference between your early 100 by 100 display area and the now larger 200 by 200 display area, this time with an interactive display of the difference in display area.

 

"Covering Tracks"

 

#

import math
def square(a, b, p):
g.pen(p)
g.line(a, b, a+10, b)
g.line(a, b, a, b+10)
g.line(a+10, b, a+10, b+10)
g.line(a, b+10, a+10, b+10)

def rattle(x, y, a, b):
g.pen(0)
square(x, y, 0)
square(x-5, y-7, 0)
g.line(x, y, a, y)
g.line(x, y, x, b)
g.line(x, b, a, b)
g.line(a, y, a, b)
for r in range(a, x):
for q in range(y, y+5):
square(r*3, q*2, 80)

g.paper(100)
while 1:

if g.getMouse(3) == 100:
x = g.getMouse(1)
y = g.getMouse(2)
print "got mouse"
if x<100:
if y<100:
rattle(x, y, 10, 10)
print "rattle"
if y>100:
rattle(x, y, 10, 10)
if x>100:
if y<100:
rattle(x, y, 10, 10)
if y>100:
rattle(x, y, 10, 10)


 

Dynamic Graphics

 

1E Make a line that responds to the mouse

 

"T"

forever
{
paper 100

pen <mouse 1>
repeat T 80 100
{
line 0 T 100 T
}
repeat T 40 60
{
line T 0 T 80
}

pen 0
line <mouse 1> 0 <mouse 2> <mouse 3>
line <mouse 1> 10 10 10
line <mouse 1> 20 <mouse 1> 20
line <mouse 1> 30 30 30
line <mouse 1> 40 <mouse 1> 40
line <mouse 1> 50 50 50
line <mouse 1> 60 <mouse 1> 60
line <mouse 1> 70 70 70
line <mouse 1> 80 <mouse 1> 80
line <mouse 1> 90 90 90
line <mouse 1> 100 <mouse 1> 100
}


 

1F Represent yourself as a dbnlet

 

"Tina in college."

// A = learning experiences and square snipets of knowledge

repeat A 5 20
{
line A 5 A 20
}
pause 10

pen 5
repeat A 15 50
{
line A 15 A 50
}
pause 10

pen 75
repeat A 72 80
{
line A 25 A 33
}
pause 10

pen 30
repeat A 45 55
{
line A 45 A 55
}
pause 10

pen 50
repeat A 25 30
{
line A 75 A 80
}
pause 20

// trying to round myself out...
pen 40
repeat B 0 100
{
line 100 B B 0
}
pause 10

// still learning more...
pen 100
repeat A 60 70
{
line A 40 A 50
}
pause 10

pen 90
repeat A 15 25
{
line A 90 A 100
}
pause 10

pen 10
repeat A 75 100
{
line A 60 A 95
}
pause 10

pen 40
repeat A 40 45
{
line A 35 A 40
}

pause 300

// now you see me, now you don't.
repeat mask 5 85
{
paper mask
}
// who knows what to believe anymore...


 

2A Using the dot drawing technique described in Chapter 8 of the DBN book, manually
position *exactly* 50 dots on your page that look as though they are randomly placed,
but still form a cohesive recognizable image that is non-typographic and non-symbolic.


"Umbrella on Grey Day."

//Grey Day.

repeat mask 5 50
{
paper mask
pause 5
}

set a 0
set b 100

//Uh-oh, looks like rain.
//Bring out the umbrella.
set [60 40] b
set [65 35] b
set [70 30] b
set [75 25] b
set [80 20] b
set [76 15] b
set [81 13] b
refresh
pause 100

//Rain.
set [5 95] a
set [15 85] a
pause 2
set [20 80] a
set [25 75] a
pause 5
set [30 70] a
set [33 67] a
pause 2
refresh
set [5 80] a
set [10 75] a
pause 5
set [20 65] a
set [25 60] a
pause 2
refresh
set [28 57] a
set [30 55] a
pause 5
//17 rain dots.

set [15 65] a
set [25 55] a
pause 3
set [27 53] a
set [30 50] a
pause 3
refresh
set [5 65] a
set [10 60] a
pause 3
refresh
set [20 50] a
set [27 43] a
pause 3
set [30 40] a
pause 3
refresh

set [15 95] a
set [25 85] a
pause 3
set [30 80] a
set [35 75] a
pause 3
refresh
set [37 73] a
pause 3
refresh

set [5 55] a
set [15 45] a
pause 3
set [25 35] a
set [30 30] a
pause 3
refresh
//30 dots.

set [5 45] a
set [15 35] a
pause 3
refresh
set [25 25] a
set [30 20] a
pause 3
refresh
set [33 17] a
set [40 10] a
pause 3
refresh
set [45 5] a
pause 20
refresh

set [5 35] a
set [10 30] a
pause 3
refresh
set [15 25] a
set [20 20] a
pause 15
refresh
set [25 15] a
set [30 10] a
pause 3
refresh
//43 rain dots.


 

7B Create a generally smooth gradation of white to black, from left to right using only a 100 percent black pen. 

 

"Tapestry Weave"

 

#
import math
g.norefresh()

def reverse(pix):
for a in range(0, 12):
if pix[a] == 0: 
pix[a] = 100
else: pass

def cross(x, y):
pix = []
xdown = [x-1, x-2, x-3]
xup = [x+1, x+2, x+3]
ydown = [y-1, y-2, y-3]
yup = [y+1, y+2, y+3]
for a in range(0, 3):
pix.append(g.getPixel(xdown[a], ydown[a]))
pix.append(g.getPixel(xdown[a], yup[a]))
pix.append(g.getPixel(xup[a], ydown[a]))
pix.append(g.getPixel(xup[a], yup[a]))
pix.append(g.getPixel(x, y))
reverse(pix)
for c in range(0, 3):
for b in range(0, 12):
g.setPixel(xdown[c], ydown[c], pix[b])
g.setPixel(xdown[c], yup[c], pix[b])
g.setPixel(xup[c], ydown[c], pix[b])
g.setPixel(xup[c], yup[c], pix[b])
g.setPixel(x, y, pix[12])


while 1:
g.paper(0)
count = 0
xcross = []
ycross = []
for x in range(0, 20):
for y in range(0, 20):
xcross.append(x)
ycross.append(y)
xcross.append(x*2)
ycross.append(y*2)
ycross.append(x*5+5)
xcross.append(y*5+10)
ycross.append(x*10-20)
xcross.append(y/5+40)
xcross.append(x-60)
ycross.append(y+60)
xcross.append(x*x)
ycross.append(y*y)
for a in range(0, 800):
cross(xcross[a], ycross[a])
#cross(ycross[a], xcross[a])
g.refresh()
g.paper(0)


 

8A Display the name of your main theme from class using dbnletters.dbn. At the top of the code list your 10 keyverbs/keyadjectives. Note that many used nouns even though they
were instructed not to -- remove all nouns and replace with verb/adjectives.

load dbnletters.dbn

"Ways of Life

We Live Life...
Look On Life"


//monastic
//on the edge
//straight and narrow
//moving and shaking
//mundane
//on cloud nine
//out and open
//in the fast lane
//sheltered
//predetermined

command firstword
{
//ways
letter 23 5 85
letter 1 17 85
letter 25 29 85
letter 19 41 85
pause 20
//of
letter 15 12 77
letter 6 24 77

}

command secondword
{

//we
letter 23 55 56
letter 5 67 56
pause 20

//live
letter 12 50 48
letter 9 62 48
letter 22 74 48
letter 5 86 48

}

command lookon
{

//look
letter 12 20 23
letter 15 32 23
letter 15 44 23
letter 11 56 23
pause 20
//on
letter 15 27 15
letter 14 39 15
}

command life
{
//life
letter 12 17 69
letter 9 29 69
letter 6 41 69
letter 5 53 69

//life
letter 12 60 40
letter 9 72 40
letter 6 84 40
letter 5 96 40

//life
letter 12 25 6
letter 9 37 6
letter 6 49 6
letter 5 61 6

}

command do
{
pen 40
life
pen 0
firstword
pause 30
pen 50
firstword

pen 0
secondword
pause 30
pen 50
secondword
pen 80
firstword

pen 0
lookon
pause 30
pen 80
secondword

pen 0
life
pause 30
pen 50
lookon
life
pen 80
lookon
pen 55
life
pause 30

}

paper 100
pause 30
repeat a 1 5
{
do
}


 

8B Choose 1 of your 10 key verbs/key adjectives from class and represent it as a single interactive piece with no typography. No static representations allowed. 

 

" Movin'+Shakin' "

#This is the world.
#The squares are parts of society.
#Those who control the mouse point are the 
#Movers and Shakers of this world.
#Nudge people to Move.
#Push peoples' buttons to Shake.

import math
g.norefresh()

def move(a, b):
g.pause(100)
square(Random(a), Random(b))

def Mod (X, Y):
return (X-(Y*(X/Y)))

def Random (D):
A = 982621
B = 82621
C = (D*A + 1)
D = Mod(C, B)
return Mod(D, 100)

def square(a, b):
g.pen(100)
g.line(a, b, a+10, b)
g.line(a, b, a, b+10)
g.line(a+10, b, a+10, b+10)
g.line(a, b+10, a+10, b+10)

def square2(c, d): 
g.line(c+5, d+3, Random(c), d+3)
g.line(c+5, d+3, c+5, Random(d))
g.line(Random(c), d+3, Random(c), Random(d))
g.line(c+5, Random(d), Random(c), Random(d))

def square3(a, b):
g.line(a, b, a+20, b)
g.line(a, b, a, b+20)
g.line(a+20, b, a+20, b+20)
g.line(a, b+20, a+20, b+20)
a = 24
b = 29
c = 62
d = 73
print "begin"
while 1:

for r in range(0, 2):
square(a+r, b+r)
for r in range(0, 2):
square2(c+r+25, d+r-15)
for r in range (0, 2):
square3(a+c-30, b+d-17)
#Be a Mover
if g.getPixel(g.getMouse(1), g.getMouse(2)) == 100:
#push it slowly...
a = Random(a)
b = Random(b)
for r in range(0, 2):
square(a+r, b+r)
c = Random(c)
d = Random(d)
for r in range(0, 2):
square2(c+r+25, d+r-15)
t = g.getTime(4)
if t%2 == 0:
g.paper(0)
a = Random(a)/4
b = Random(b)/2
for r in range(0, 2):
square(a+r, b+r)
for r in range(0, 2):
square2(c+r+25, d+r-15)
print a

if t%2 == 1:
g.paper(0)
a = Random(a)
b = Random(b)
for r in range(0, 2):
square(a+r, b+r)
square(a, b)
for r in range(0, 2):
square2(c+r+25, d+r-15)
square(c, d)
#Be a Shaker
#moves the entire canvas plus more because of the way DBN is built
if g.getMouse(3) == 100:
g.pause(2)
g.move(a, b)
a = Random(a)
b = Random(b)
for r in range(0, 2):
square(a+r, b+r)
for r in range(0, 2):
square2(c+r+25, d+r-15)
print "shaken"
g.refresh()
g.paper(0)


 

9A Your display is now 200 by 200. Emphasize the difference between your early 100 by100 display area and the now larger 200 by 200 display area with a statically motivated
graphic.

 

"emphasis on empty"


#
import math
g.paper(100)

#Wind
b = []
for i in range(0, 100):
b.append(i)
for j in range(0, 100):
g.setPixel(i, (j*2), (i*4))
if i > (j*j):
g.setPixel(i, (j*j), 0)
#Bird
for i in range(1, 50):
g.pen(i)
angle = (i/30.0) * math.pi
radius = i
x = int(60+math.cos(angle)*radius)
y = int(70+math.sin(angle)*radius)
g.line(y, x, x, 10)


g.norefresh()

def reverse(pix):
for a in range(0, 12):
if pix[a] == 0: 
pix[a] = 100
else: pass

def cross(x, y):
pix = []
xdown = [x-1, x-2, x-3]
xup = [x+1, x+2, x+3]
ydown = [y-1, y-2, y-3]
yup = [y+1, y+2, y+3]
for a in range(0, 3):
pix.append(g.getPixel(xdown[a], ydown[a]))
pix.append(g.getPixel(xdown[a], yup[a]))
pix.append(g.getPixel(xup[a], ydown[a]))
pix.append(g.getPixel(xup[a], yup[a]))
pix.append(g.getPixel(x, y))
reverse(pix)
for c in range(0, 3):
for b in range(0, 12):
g.setPixel(xdown[c], ydown[c], 0)
g.setPixel(xdown[c], yup[c], 0)
g.setPixel(xup[c], ydown[c], 0)
g.setPixel(xup[c], yup[c], 0)
g.setPixel(x, y, pix[12])

count = 0
xcross = [] #x values for cross centers
ycross = [] #y values for cross centers

for i in range(0, 204):
xcross.append(int(i*math.sin(i)*10+20))
xcross.append(int(i*math.sin(i)+90))
ycross.append(int(i*math.cos(i)*5+25))
ycross.append(int(i*math.cos(i)+90))
cross(xcross[i], ycross[i])
g.refresh()

for a in range(100, 201):
g.pen(0)
g.line(0, a, 201, a)
g.refresh()
g.line(a, 0, a, 201)
g.refresh()


 

9B Do problem 9A, this time with a temporal display of the difference in display area.

 

"touch edges"

#the rectangle stays stationary, while the canvas moves
#in essence, it touches all the edges of the big canvas, 
#emphasizing its size.

import math
g.norefresh()

def des(a, b):
for r in range(a, a+100):
g.pen(100)
g.line(b, r, b+40, r)

def tilly(i, j, a, b):
g.paper(0)
g.move(i, j)
des(a, b)
g.refresh()
g.pause(5)
#i = x pos of canvas (abs)
#j = -y pos of canvas (abs)
#a = box ycoord
#b = box xcoord

while 1:
print "begin" 
tilly(0, 0, 50, 80)
print "after begin"
tilly(10, -10, 40, 70)
print "a"
tilly(0, 0, 50, 80)
print "after begin"
tilly(40, 30, 80, 40)
print "b"
tilly(0, 0, 50, 80)
print "after begin"
tilly(-30, 50, 100, 110)
print "c"