initial upload

This commit is contained in:
Luxferre
2026-06-13 12:05:25 +03:00
commit c40f39ae23
6 changed files with 703 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
REM
REM --- Tiny BASIC Interpreter and Compiler Project
REM --- Lunar Lander Demonstration Game
REM
REM --- Released as Public Domain by Damian Gareth Walker 2019
REM --- Created: 15-Aug-2019
REM
REM --- Variables:
REM A: altitude
REM B: fuel to burn this turn
REM F: fuel remaining
REM T: time elapsed
REM V: velocity this turn
REM W: velocity next turn
REM --- Initialise the Program
50 LET A=1000
51 LET B=0
52 LET F=150
53 LET V=50
54 LET T=0
REM --- Main Loop
100 PRINT "Time:",T," Alt:",A," Velocity:",V," Fuel:",F," Thrust:",B
111 IF F>30 THEN PRINT "Thrust (0-30)?"
112 IF F<31 THEN PRINT "Thrust (0-",F,")?"
113 INPUT B
114 IF B>=0 THEN IF B<=30 THEN IF B<=F THEN GOTO 120
115 GOTO 111
120 LET W=V-B+5
121 LET F=F-B
122 LET A=A-(V+W)/2
123 LET V=W
124 LET T=T+1
125 IF A>0 THEN GOTO 100
REM --- End of Game
126 IF V<5 THEN GOTO 140
127 PRINT "You crashed!"
130 GOTO 160
140 IF A<0 THEN GOTO 150
141 PRINT "Perfect landing!"
142 GOTO 160
150 PRINT "Touchdown."
160 IF A<0 THEN LET A=0
165 PRINT "Time:",T," Alt:",A," Velocity:",V," Fuel:",F
170 END
+75
View File
@@ -0,0 +1,75 @@
REM
REM --- Tiny BASIC Interpreter and Compiler Project
REM --- Mugwump Demonstration Game
REM
REM --- Released as Public Domain by Damian Gareth Walker 2019
REM --- Created: 13-Aug-2019
REM
REM --- Variables
REM C: axis diff between player guess and mugwump position
REM D: distance between player guess and mugwump position
REM G: mugwump column
REM H: mugwump row
REM M: moves taken
REM R: random number generator seed
REM X: player guess column
REM Y: player guess row
REM --- Initialise the random number generator
1 PRINT "Think of a number."
2 INPUT R
3 IF R<0 THEN LET R=0
4 IF R>4095 THEN LET R=4095
REM --- Initialise the game
5 GOSUB 200
6 LET G=R-(R/10*10)
6 GOSUB 200
7 LET H=R-(R/10*10)
8 LET M=0
REM --- Input player guess
10 PRINT "Where is the mugwump? Enter column then row."
11 INPUT X,Y
12 IF X>=0 THEN IF X<=9 THEN IF Y>=0 THEN IF Y<=9 THEN GOTO 20
13 PRINT "That location is off the grid!"
14 GOTO 10
REM --- Process player guess
20 LET M=M+1
21 PRINT "The mugwump is..."
22 LET D=0
23 LET C=G-X
24 GOSUB 60
25 LET C=H-Y
26 GOSUB 60
27 IF D=0 THEN GOTO 40
28 PRINT "...",D," cells away."
29 IF M>10 THEN GOTO 50
30 PRINT "You have taken ",M," turns so far."
35 GOTO 10
REM --- Player has won
40 PRINT "...RIGHT HERE!"
45 PRINT "You took ",M," turns to find it."
47 END
REM --- Player has lost
50 PRINT "You have taken too long over this. You lose!"
END
REM --- Helper subroutine to calculate distance from player to mugwump
REM Inputs: C - difference in rows or columns
REM D - running total distance
REM Output: D - running total distance, updated
60 IF C<0 THEN LET C=-C
65 LET D=D+C
70 RETURN
REM --- Random number generator
REM Input: R - current seed
REM Outputs: R - updated seed
200 LET R=5*R+35
210 LET R=R-R/4096*4096
220 RETURN
+14
View File
@@ -0,0 +1,14 @@
10 print "number";
20 input x
30 g=x/2
40 if x>=16 THEN g=x/4
50 if x>=64 g=x/8
60 if x>=256 g=x/16
70 if x>=4096 g=x/64
80 if x>=16384 g=x/128
90 p=g
100 g=(g+x/g)/2
110 if g-p>1 goto 90
120 if p-g>1 goto 90
130 print "square root is ";g
140 end