Add examples.

This commit is contained in:
Lawrence Kesteloot 2018-08-06 00:25:27 -07:00
parent 3be787dc11
commit 184262ca3e
8 changed files with 130 additions and 0 deletions

9
examples/circle.bas Normal file
View File

@ -0,0 +1,9 @@
10 GR
15 COLOR=5
20 Y = 0
30 X = 0
40 IF (20-X)*(20-X) + (20-Y)*(20-Y) < 100 THEN PLOT X, Y
50 X = X + 1
60 IF X < 40 GOTO 40
70 Y = Y + 1
80 IF Y < 40 GOTO 30

View File

@ -0,0 +1,7 @@
10 GR
15 COLOR=5
20 FOR Y = 0 TO 39
30 FOR X = 0 TO 39
40 PLOT X,Y
50 NEXT X
60 NEXT Y

View File

@ -0,0 +1,12 @@
10 GR
20 Y = 0
25 C = 1
30 X = 0
40 COLOR=C
45 PLOT X, Y
50 X = X + 1
55 C = C + 1
56 IF C = 16 THEN C = 1
60 IF X < 40 GOTO 40
70 Y = Y + 1
80 IF Y < 40 GOTO 30

43
examples/stars.bas Normal file
View File

@ -0,0 +1,43 @@
10 GR
20 TS = 40
30 DIM DX(9),DY(9),C(9),X(9),Y(9)
1000 DX(0) = 14
1005 DY(0) = 13
1010 C(0) = 14
1100 DX(1) = 18
1105 DY(1) = 8
1110 C(1) = 5
1200 DX(2) = 7
1205 DY(2) = -18
1210 C(2) = 12
1300 DX(3) = 9
1305 DY(3) = 17
1310 C(3) = 3
1400 DX(4) = 19
1405 DY(4) = 2
1410 C(4) = 12
1500 DX(5) = -19
1505 DY(5) = 0
1510 C(5) = 4
1600 DX(6) = -2
1605 DY(6) = 19
1610 C(6) = 14
1700 DX(7) = 0
1705 DY(7) = -19
1710 C(7) = 4
1800 DX(8) = -18
1805 DY(8) = -7
1810 C(8) = 4
1900 DX(9) = 14
1905 DY(9) = 13
1910 C(9) = 11
2100 FOR T = 0 TO TS
2200 FOR I = 0 TO 9
2210 OX = X(I) : OY = Y(I)
2220 X(I) = 20 + DX(I) * T / TS
2230 Y(I) = 20 + DY(I) * T / TS
2240 COLOR=0 : PLOT OX, OY
2250 COLOR=C(I) : PLOT X(I), Y(I)
2260 NEXT
2300 NEXT
2310 GOTO 2100

30
examples/stars.py Normal file
View File

@ -0,0 +1,30 @@
import random
import math
str = """%(init)d00 DX(%(which)d) = %(x)d
%(init)d05 DY(%(which)d) = %(y)d
%(init)d10 C(%(which)d) = %(c)d"""
print "10 GR"
print "20 TS = 40"
print "30 DIM DX(9),DY(9),C(9),X(9),Y(9)"
for i in range(0,10) :
angle = random.uniform(0,.999)
x = int(20 * math.cos(angle * 3.14159 * 2))
y = int(20 * math.sin(angle * 3.14159 * 2))
c = random.randrange(1,15)
print str % {'init' : 10 + i, 'x' : x, 'y' : y, 'c' : c, 'which' : i}
print "2100 FOR T = 0 TO TS"
print "2200 FOR I = 0 TO 9"
print "2210 OX = X(I) : OY = Y(I)"
print "2220 X(I) = 20 + DX(I) * T / TS"
print "2230 Y(I) = 20 + DY(I) * T / TS"
print "2240 COLOR=0 : PLOT OX, OY"
print "2250 COLOR=C(I) : PLOT X(I), Y(I)"
print "2260 NEXT"
print "2300 NEXT"
print "2310 GOTO 2100"

View File

@ -0,0 +1,7 @@
10 HOME
20 FOR CH=65+128 TO 69+128
30 FOR AD = 1024 TO 2047
40 POKE AD, CH
50 NEXT
60 NEXT

View File

@ -0,0 +1,8 @@
10 HOME
20 CH = 65+128
30 AD = 1024
40 POKE AD,CH
50 AD = AD + 1
60 IF AD < 2048 GOTO 40
70 CH = CH + 1
80 IF CH < 70+128 GOTO 30

View File

@ -0,0 +1,14 @@
10 FOR A = 1 TO 10
20 FOR B = 1 TO 10
30 FOR C = 1 TO 10
40 FOR D = 1 TO 10
50 FOR E = 1 TO 10
60 FOR F = 1 TO 10
70 FOR G = 1 TO 10
80 FOR H = 1 TO 10
90 FOR I = 1 TO 10
100 FOR J = 1 TO 10
110 FOR K = 1 TO 10
120 FOR L = 1 TO 10
130 FOR M = 1 TO 10