26 lines
895 B
Text
26 lines
895 B
Text
function draw_line(sequence res, integer x,y,dx,dy,len,c)
|
|
string line = '+'&repeat(c,len-2)&'+'
|
|
for i=1 to len do
|
|
res[y,x] = line[i]
|
|
y += dy; x += dx
|
|
end for
|
|
return res
|
|
end function
|
|
|
|
procedure ascii_cuboid(integer x,y,z)
|
|
sequence res = repeat(repeat(' ',x+z+3),y+z+3)
|
|
res = draw_line(res, 1, z+2,+1,-1,z+2,'/')
|
|
res = draw_line(res, x+2, z+2,+1,-1,z+2,'/')
|
|
res = draw_line(res, x+2,y+z+3,+1,-1,z+2,'/')
|
|
res = draw_line(res, 1, z+2, 0,+1,y+2,'|')
|
|
res = draw_line(res, x+2, z+2, 0,+1,y+2,'|')
|
|
res = draw_line(res,x+z+3, 1, 0,+1,y+2,'|')
|
|
res = draw_line(res, z+2, 1,+1, 0,x+2,'-')
|
|
res = draw_line(res, 1, z+2,+1, 0,x+2,'-')
|
|
res = draw_line(res, 1,y+z+3,+1, 0,x+2,'-')
|
|
printf(1,"%s\n",{join(res,"\n")})
|
|
end procedure
|
|
ascii_cuboid(0,0,0)
|
|
ascii_cuboid(1,1,1)
|
|
ascii_cuboid(2,1,2)
|
|
ascii_cuboid(3,2,1)
|