mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-13 22:46:06 +09:00
dos: text substitution using dollar sign
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
1 FOR I = 99 TO 1 STEP -1
|
||||
2 MODE = 1
|
||||
3 GOSUB 12
|
||||
4 PRINT I;" bottle";BOTTLES;" of beer on the wall, ";i;" bottle";BOTTLES;" of beer."
|
||||
5 MODE = 2
|
||||
6 GOSUB 12
|
||||
7 PRINT "Take one down and pass it around, ";(I-1);" bottle";BOTTLES;" of beer on the wall."
|
||||
8 NEXT
|
||||
9 PRINT "No more bottles of beer on the wall, no more bottles of beer."
|
||||
10 PRINT "Go to the store and buy some more. 99 bottles of beer on the wall."
|
||||
11 END
|
||||
12 IF I == MODE THEN BOTTLES = "" ELSE BOTTLES = "s"
|
||||
13 RETURN
|
||||
10 FOR I = 99 TO 1 STEP -1
|
||||
20 MODE = 1
|
||||
30 GOSUB 120
|
||||
40 PRINT I;" bottle";BOTTLES;" of beer on the wall, ";i;" bottle";BOTTLES;" of beer."
|
||||
50 MODE = 2
|
||||
60 GOSUB 120
|
||||
70 PRINT "Take one down and pass it around, ";(I-1);" bottle";BOTTLES;" of beer on the wall."
|
||||
80 NEXT
|
||||
90 PRINT "No more bottles of beer on the wall, no more bottles of beer."
|
||||
100 PRINT "Go to the store and buy some more. 99 bottles of beer on the wall."
|
||||
110 END
|
||||
120 IF I == MODE THEN BOTTLES = "" ELSE BOTTLES = "s"
|
||||
130 RETURN
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
10 DEFUN FAC(N)=IF N==0 THEN 1 ELSE N*FAC(N-1)
|
||||
20 K=MAP FAC, 1 TO 10
|
||||
20 K=MAP(FAC, 1 TO 10)
|
||||
30 PRINT K
|
||||
|
||||
@@ -107,10 +107,10 @@
|
||||
857 GOTO 990
|
||||
860 PRINT "IN YOUR 10-YEAR TERM OF OFFICE, ";P1;" PERCENT OF THE"
|
||||
862 PRINT "POPULATION STARVED PER YEAR ON THE AVERAGE, I.E. A TOTAL OF"
|
||||
865 PRINT D1;"PEOPLE DIED!!"
|
||||
865 PRINT D1;" PEOPLE DIED!!"
|
||||
866 L=A/P
|
||||
870 PRINT "YOU STARTED WITH 10 ACRES PER PERSON AND ENDED WITH"
|
||||
875 PRINT L;"ACRES PER PERSON."
|
||||
875 PRINT L;" ACRES PER PERSON."
|
||||
876 PRINT
|
||||
880 IF P1>33 THEN GOTO 565
|
||||
885 IF L<7 THEN GOTO 565
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
10 DEFUN LESS(P,X)=X<P
|
||||
11 DEFUN GTEQ(P,X)=X>=P
|
||||
12 DEFUN QSORT(XS)=IF LEN(XS)<1 THEN NIL ELSE QSORT(FILTER(LESS~<HEAD(XS),TAIL(XS))) # HEAD(XS)!NIL # QSORT(FILTER(GTEQ~<HEAD(XS),TAIL(XS)))
|
||||
10 QSORT=[XS]~>IF LEN(XS)<1 THEN NIL ELSE QSORT(FILTER([X]~>X<HEAD XS,TAIL XS)) # HEAD(XS)!NIL # QSORT(FILTER([X]~>X>=HEAD XS,TAIL XS))
|
||||
100 L=7!9!4!5!2!3!1!8!6!NIL
|
||||
110 PRINT L
|
||||
120 PRINT QSORT(L)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
10 print(chr(47+round(rnd(1))*45);)
|
||||
20 goto 10
|
||||
10 PRINT(CHR(47+ROUND(RND(1))*45);)
|
||||
20 GOTO 10
|
||||
|
||||
Reference in New Issue
Block a user