10 CLEAR ALL
20 RANDOMIZE TIMER
30 DIM p$(10)
40 idea$="Print 'Hello world!'"
50 ic=10
60 DIM ideas$(ic)
70 FOR i=1 TO ic
80     READ ideas$(i)
90 NEXT i
100 CLS
110 PRINT LINE CENTER "CODE GENERATOR",RGB(255,255,255),RGB(255,0,0)
120 PRINT
130 INK RGB(255,255,255)
140 PRINT "(1) Enter a short program description"
150 PRINT "(2) Suggest an idea"
160 PRINT "(3) Ask ChatGPT for an idea"
170 PRINT
180 PRINT "(G) Generate code"
190 PRINT "(Q) Quit"
200 PRINT
210 INK RGB(255,255,0)
220 PRINT WORDWRAP$(idea$)
230 INK RGB(255,255,255)
240 GETKEY a$
250 SELECT CASE UCASE$(a$)
260     CASE "1"
270         INK RGB(255,255,0)
280         LOCATE 1,YPOS(1)-1
290         LINE INPUT idea$ PRESERVE
300         IF n$<>"" THEN idea$=n$
310     CASE "2"
320         n$=ideas$(RANGE(1,ic))
330         idea$=n$
340     CASE "3"
350         PRINT
360         PRINT "Generating..."
370         PRINT
380         PAUSE
390         CHAT "Suggest in one sentence a new idea for a simple random program in the BASIC language." TO idea$
400     CASE "G"
410         GOTO 500
420     CASE "S"
430         GOTO 620
440     CASE "Q"
450         END
460     CASE ELSE
470         GOTO 240
480 END SELECT
490 GOTO 100
500 PRINT
510 PRINT "Generating..."
520 PRINT
530 PAUSE
540 CODE idea$ TO p$()
550 c=UBOUND(REF p$())
560 FOR i=0 TO c
570     PRINT CODE p$(i)
580 NEXT i
590 PRINT "Press (S) to save, any other key to try again."
600 GETKEY a$
610 IF UCASE$(a$)<>"S" THEN 100
620 PRINT
630 PRINT "Enter a filename: ";
640 LINE INPUT f$
650 IF f$<>"" THEN
660     IF LCASE$(RIGHT$(f$,4))<>".bas" THEN f$=f$+".bas"
670     n=FREEFILE
680     OPEN f$ FOR OUTPUT AS #n
690     FOR i=0 TO c
700         PRINT #n,p$(i)
710     NEXT i
720     CLOSE #n
730     PRINT
740     PRINT "Saved "+CHR$(34)+f$+CHR$(34)+"!"
750     GETKEY a$
760 END IF
770 GOTO 100
780 DATA "Input a string and print it in reverse."
790 DATA "Print the first 300 prime numbers."
800 DATA "Print the first 100 Roman numerals."
810 DATA "Input a sentence and print the first word."
820 DATA "Input a sentence and print the last word."
830 DATA "Print the first 20 numbers in the Fibonacci sequence."
840 DATA "Demonstrate a simple use of recursion."
850 DATA "Input a sentence and count the number of words in it."
860 DATA "Generate a random strong password."
870 DATA "Pick a random number between 1 and 100 and have the user guess it."
