### Tiny Craft Basic Interpreter

Posted:

**Sun Dec 11, 2022 3:02 am**I have just released my own Tiny Basic written in QuickBasic.

It's called Tiny Craft Basic and is the DOS version of Craft Basic.

It has a line mode editor and aims to be very similar to classic Tiny Basic.

Homepage: http://www.lucidapogee.com/forum/viewtopic.php?p=4

Here's it's example programs.

It's called Tiny Craft Basic and is the DOS version of Craft Basic.

It has a line mode editor and aims to be very similar to classic Tiny Basic.

Homepage: http://www.lucidapogee.com/forum/viewtopic.php?p=4

Here's it's example programs.

Code: Select all

```
10 cls
20 print "Solve For Quadratic Roots"
30 input "a: ",a
40 input "b: ",b
50 input "c: ",c
60 print "Roots: ",(-1*b+sqrt(b^2-4*a*c))/(2*a),comma," ",(-1*b-sqrt(b^2-4*a*c))/(2*a)
70 shell "pause"
```

Code: Select all

```
5 cls
10 print "NIM"
20 let h = int(rnd * 12) + 12
30 print "There are ", h ," tokens remaining."
40 input "How many would you like to take? ", t
50 if t > 3 or t < 1 then 140
60 if h - t < 0 then 160
70 let h = h - t
80 if h = 0 then 180
90 let t = 4 - t
91 if h < 15 then 93
92 let t = 3
93 if h > 3 then 100
94 let t=h
100 print "I will take ", t ," tokens."
110 let h = h - t
120 if h = 0 then 200
130 goto 30
140 print "You must take between 1 to 3 tokens."
150 goto 40
160 print "You cannot take that many. There's only ", h ," left."
170 goto 40
180 print "Congratulations. You got the last token."
190 goto 210
200 print "I got the last token. I win. Better luck next time."
210 shell "pause"
```

Code: Select all

```
10 cls
20 input "Temperature in Kelvin: ", k
30 let c = k + 273
40 let r = ( 9 * k ) / 5
50 let f = r + 460
60 print c, " Celsius"
70 print f, " Fahrenheit"
80 print r, " Rankine"
90 shell "pause"
```

Code: Select all

```
10 cls
20 let r = int(rnd * 100) + 1
30 print "hilo game"
40 print "guess the nusmber between 1 and 100"
50 rem loop
60 let t = t + 1
70 input "guess: ", g
80 if g <> r then 110
90 print "you guessed it in ", t ," tries."
100 goto 220
110 rem endif
120 if g > r or g < 1 then 140
130 print "too low"
140 rem endif
150 if g < r or g > 100 then 170
160 print "too high"
170 rem endif
180 if g >= 1 and g <= 100 then 200
190 print "invalid guess"
200 rem endif
210 if g <> r then 50
220 shell "pause"
```

Code: Select all

```
'fibonacci example
10 cls
20 let a = 1
30 let b = 1
40 print "Fibonacci Sequence"
50 rem loop
60 let s = a + b
70 let a = b
80 let b = s
90 let i = i + 1
100 print s
120 if i < 20 then 50
130 shell "pause"
140 end
```

Code: Select all

```
1 shell "echo Data analasys results:>results.dat"
10 cls
20 print "Find how long it takes to generate 1 out of 100 a total of 10"
30 print "times while recording the results to a data file using shell."
40 shell "pause"
50 let c = 10
60 rem loop
70 let t = clock
80 rem loop
90 let r = int(rnd * 100) + 1
100 print "Random number: ", r
110 if r <> 1 then 80
120 let d = clock - t
130 let a = a + d
140 shell "echo ", d ,">>results.dat"
150 let c = c - 1
160 if c <> 0 then 60
170 let a = a / 10
180 shell "echo Average time = ", a ,">>results.dat"
190 print "done. check the file results.dat"
200 shell "pause"
210 end
```

Code: Select all

```
5 cls
10 print "Timer"
20 input "Seconds? ", l
30 let t = clock
40 rem loop
50 let c = clock
60 print c
70 if c < t + l then 40
80 print "Alarm!"
90 shell "pause"
```

Code: Select all

```
10 cls
20 let area = 0
30 let height = 0
40 let radius = 0
50 let pi = 3.14
60 print "Find the surface area of a cylinder."
70 input "height: ", height
80 input "radius: ", radius
90 let area = radius * 2 * pi * ( radius + height )
100 print "Surface area: ", area
110 shell "pause"
```