Sunday, December 30, 2012

Snowman

# Snowman by V

y=20
color cyan
rect 0,0,300,300
color white
circle 100,230+y,50
circle 100,150+y,45
circle 100,70+y,40
colour black
circle 90,60+y,5
circle 110,60+y,5
circle 100,85+y,5
circle 110,85+y,5
circle 90,85+y,5
circle 80,80+y,5
circle 120,80+y,5

Saturday, December 29, 2012

Rosetta Code example

# This is a code example in basic 256 that you can find in Rosetta code website http://rosettacode.org/wiki/Greyscale_bars/Display. There you will find this program (and more) in many other languages such as Java Python and C, and that is a very good way to learn new programming languages.

h=ceil(graphheight/4)
for row=1 to 4
w=ceil(graphwidth/(8*row))
c=255/(8*row-1)
for n = 0 to (8*row-1)
color rgb(255-c*n,255-c*n,255-c*n)
if row/2 = int(row/2) then color rgb(c*n,c*n,c*n)
rect n*w,h*(row-1),w,h
next n
next row

Friday, December 28, 2012

Gears

clg
fastgraphics
dim x(3)
dim y(3)
dim rad(3)
dim init(3)
x[0]=150
y[0]=150
rad[0]=70
init[0]=0
x[1]=220
y[1]=220
rad[1]=35
init[1]=-.15
x[2]=90
y[2]=90
rad[2]=21
init[2]=.2
for rot = 0 to 100000
   for w = 0 to 2
      circle x[w],y[w],rad[w]-8
      tri = {0, 0, -5, rad[w], 5, rad[w]}
      for r = 0 to 2*pi step pi*7/rad[w]
           if w=1 or w=2 then clock = -rot
           if w=0 then clock = rot
           stamp x[w],y[w],1,r+init[w]+clock/(7*rad[w]),tri
       next r
    next w
    refresh
    clg
next rot

Saturday, December 22, 2012

Flags 2


# Union jack
color blue
rect 0,0,300,300
color white
poly {0,20,0,0,20,0,300,280,300,300,280,300}
poly {280,0,300,0,300,20,20,300,0,300,0,280}
color red
poly {0,10,0,0,10,0,300,290,300,300,290,300}
poly {290,0,300,0,300,10,10,300,0,300,0,290}
color white
rect 120,0,60,300
rect 0,120,300,60
color red
rect 130,0,40,300
rect 0,130,300,40
pause 2
# Stars and Stripes
for n = 0 to 13 step 2
color red
rect 0,n*23,300,23
color white
rect 0,(n+1)*23,300,23
next n
font "arial",15,100
color blue
rect 0,0,120,7*23
color white
for x = 1 to 6
for y = 1 to 5
text x*18-8,y*34-27,"*"
next y
next x
for x = 1 to 5
for y = 1 to 4
text x*18,y*34-10,"*"
next y
next x
Rem Триколор
color white
rect 0,0,300,100
color blue
rect 0,100,300,100
color red
rect 0,200,300,100

Thursday, December 20, 2012

Train

# by C&F
fastgraphics
x=0
speed=1
loop:
x=x+speed
speed=speed+.03
if x>1 then speed=2
clg
pause .01
color black
if x > 400 then x=-100
rect 10+x,160,30,60
color orange
rect 10+x,195,120,50
color grey
circle 70+x,250,15
circle 110+x,250,15
circle 35+x,250,15
color black
circle 70+x,250,5
circle 110+x,250,5
circle 35+x,250,5
colour black
rect -30+x,220,40,10
color red
rect -100+x,195,75,50
color grey
circle -80+x,250,15
circle -40+x,250,15
color black
circle -80+x,250,5
circle -40+x,250,5
refresh
goto loop

Blimp


# Blimp by R
clg
fastgraphics
x=0
y=60
font "arial",15,50
loop:
x=x+.2
if x>300 then x = -220
color grey
circle 150-x,70+y,50
circle 120-x,70+y,50
circle 180-x,70+y,50
color black
rect 100-x,100+y,100,40
Text 120-x,70+y,"R&S Inc."
color white
circle 120-x,120+y,5
circle 150-x,120+y,5
circle 180-x,120+y,5
refresh
clg
goto loop

Cool person


# Cool person by R
clg
color 255,160,160
circle(150,50,50)
color 255,160,160
rect(146,100,10,10)
color blue
circle(130,40,5)
color blue
circle(170,40,5)
color yellow
x=120
y=15
poly {x+25,y+25,x+50,y+50,x+25,y+50}
color red
rect(140,80,30,10)
color green
rect(100,110,110,75)
color red
rect (130,75,10,10)
color red
rect (170,75,10,10)

Ambulance

# Ambulance by V
fastgraphics
x=0
y=0
loop:
x=x+1
if x>1000 then x = 0
colour darkgreen
rect 0,0,900,300
colour red
circle 950-x,225+y,10
color White
rect 910-x,270+y,60,20
rect 930-x,230+y,70,60
color red
rect 950-x,250+y,30,10
color red
rect 960-x,240+y,10,30
color black
circle 925-x,290+y,10
circle 990-x,290+y,10
refresh
clg
goto loop

House


#house by F
fastgraphics
x=1
loop:
if x> 100 then x=1
x=x+.1
colour red
rect 100,100,100,100
colour black
rect 140,150,25,50
colour darkred
rect 175,50,25,50
colour grey
circle 185,45-x,5
circle 200,45-x,4
circle 190,45-x,3
circle 180,45-x,2
refresh
clg
goto loop

Sunday, December 2, 2012

Venny

#Venn diagrams and logical operators
Font "Arial",30,100
For s = 1 to 5
clg
Text 20,20 ,"A"
Text 260,20 ,"B"
gosub circles
For n = 1 to 2000
x=rand*300
y=rand*300
A=0
B=0
gosub checkA
gosub checkB
if s = 1 then gosub one
if s = 2 then gosub two
if s = 3 then gosub three
if s = 4 then gosub four
if s = 5 then gosub five
next n
next s
end
one:
Text 140,250 ,"A"
if A=1 then circle x,y,2
return
two:
Text 100,250 ," A"+chr(1352)+"B"
if A=1 and B=1 then circle x,y,2
return
three:
Text 100,250 ," A"+chr(1357)+"B"
if A=1 or B=1 then circle x,y,2
return
four:
Text 120,250 ,"A'"
if not A=1 then circle x,y,2
return
five:
Text 100,250 ,"(A"+chr(1357)+"B)'"
if not (A=1 or B=1) then circle x,y,2
return
checkA:
if (x-100)^2+(y-150)^2<10000 then A=1
Return
checkB:
if (x-200)^2+(y-150)^2<10000 then B=1
Return
circles:
For x = 1 to 300
y=(-(x-200)^2+10000)^.5+150
circle x,y,2
circle x,-y+300,2
circle x-100,y,2
circle x-100,-y+300,2
next x
return