QB64 Phoenix Edition
program generated by chatgpt - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: Chatting and Socializing (https://staging.qb64phoenix.com/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://staging.qb64phoenix.com/forumdisplay.php?fid=2)
+--- Thread: program generated by chatgpt (/showthread.php?tid=1289)

Pages: 1 2


program generated by chatgpt - James D Jarvis - 12-16-2022

this program was generated by chat gpt. I did have to lightly edit it because it tried to use the symbol "&" in place of the symbol ";" in print commands, otherwise it all came from this prompt:

create qb64pe source code that allows the user to select from a displayed list of 10 entries.

Code: (Select All)
' Define an array to hold the list of entries
Dim entries(10) As String

' Populate the array with sample data
entries(1) = "Apple"
entries(2) = "Banana"
entries(3) = "Cherry"
entries(4) = "Date"
entries(5) = "Eggplant"
entries(6) = "Fig"
entries(7) = "Grape"
entries(8) = "Honeydew"
entries(9) = "Kiwi"
entries(10) = "Lemon"

' Display the list of entries
Print "Please select an entry from the list:"
For i = 1 To 10
    Print i; ") "; entries(i)
Next i

' Get the user's selection
Do
    Input "Enter your selection: ", selection
    If selection < 1 Or selection > 10 Then
        Print "Invalid selection. Please try again."
    Else
        Exit Do
    End If
Loop

' Display the selected entry
Print "You selected: "; entries(selection)



RE: program generated by chatgpt - James D Jarvis - 12-16-2022

create a qb64PE program listing that prints a rocket in ascii graphics

Code: (Select All)
' Print the top of the rocket
Print "    /\ "
Print "   /  \ "
Print "  /____\ "
Print "  \    / "

' Print the body of the rocket
Print "  |    | "
Print "  |    | "
Print "  |    | "

' Print the base of the rocket
Print "  /    \ "
Print " /      \ "
Print "/________\ "

' Print the exhaust flames
Print "   \  / "
Print "    \/ "



RE: program generated by chatgpt - Pete - 12-16-2022

Where's the rocket? All I see is a chess piece with a gas problem.

Pete


RE: program generated by chatgpt - James D Jarvis - 12-16-2022

create a qb64PE program to randomly generate a smiley face with a prompt to continue with a new face or quit the program.    

Code: (Select All)
' Random Smiley Face Program
' Author: OpenAI

Randomize Timer

Dim Smiley(3) As String * 5

Smiley(1) = ":)"
Smiley(2) = ":D"
Smiley(3) = ";)"

Do
    Print Smiley(Int(Rnd(1) * 3) + 1)
    Print "Press 'N' for a new smiley, or 'Q' to quit."
    Input choice$
Loop While UCase$(choice$) <> "Q"

End

(12-16-2022, 07:15 PM)Pete Wrote: Where's the rocket? All I see is a chess piece with a gas problem.

Pete

I'll give the AI a pass on the gas.


RE: program generated by chatgpt - Pete - 12-16-2022

[Image: ascii-snoopy.jpg]

Curse you, Red Baron!


RE: program generated by chatgpt - James D Jarvis - 12-16-2022

Looks like you bested the ai.  Here's the code it generated for: produce program source code for QB64PE that will generate an ascii image of snoopy cursing the red baron

NOTE: THIS CODE WILL NOT WORK.
Code: (Select All)
' QB64PE ASCII Art program to generate an image of Snoopy cursing the Red Baron
' Requires QB64PE to run

SCREEN _NEWIMAGE(640, 480, 32)

' Define variables to hold the ASCII art text
DIM snoopy AS STRING
DIM redBaron AS STRING

' Set the ASCII art text for Snoopy and the Red Baron
snoopy = "                                                                                "
snoopy = snoopy + "    .--.                                                                      "
snoopy = snoopy + "   : (\\/) :                                                                   "
snoopy = snoopy + "    '--'                                                                       "
snoopy = snoopy + "   /(   )\\                                                                    "
snoopy = snoopy + "  |  ''  |                                                                     "
snoopy = snoopy + "  |       |                                                                     "
snoopy = snoopy + "  |       |                                                                     "
snoopy = snoopy + "  |       |                                                                     "
snoopy = snoopy + " _|       |_                                                                    "
snoopy = snoopy + "(' \\     / ')                                                                  "
snoopy = snoopy + "  \\  '._.'  /                                                                  "
snoopy = snoopy + "   '-.___.-'                                                                    "

redBaron = "                                                                                "
redBaron = redBaron + "         .-.                                                                    "
redBaron = redBaron + "        (   ).                                                                  "
redBaron = redBaron + "       (___(__)                                                                 "
redBaron = redBaron + "       /:  V   \\                                                                "
redBaron = redBaron + "      /:  / \\   \\                                                              "
redBaron = redBaron + "     /:  /   \\   \\                                                             "
redBaron = redBaron + "    /:  /     \\   \\                                                            "
redBaron = redBaron + "   /:  /       \\   \\                                                           "
redBaron = redBaron + "  /:  /         \\   \\                                                          "
redBaron = redBaron + " /:  /           \\   \\                                                         "
redBaron = redBaron + "(____________________)                                                            "

' Set the font and text color
_FONT "Courier New", 20
_COLORDD WHITE

' Draw the ASCII art text on the screen
_DRAWTEXT snoopy, 10, 10
_DRAWTEXT redBaron, 10, 120

' Wait for a key press to exit the program
WHILE INKEY$ = ""
WEND

END



RE: program generated by chatgpt - Pete - 12-16-2022

Steve, we need a new forum tag now..

[Clippy]
NOTE: THIS CODE WILL NOT WORK.
[/Clippy]


RE: program generated by chatgpt - madscijr - 12-16-2022

(12-16-2022, 07:11 PM)James D Jarvis Wrote: create a qb64PE program listing that prints a rocket in ascii graphics

Code: (Select All)
' Print the top of the rocket
Print "    /\ "
Print "   /  \ "
Print "  /____\ "
Print "  \    / "

' Print the body of the rocket
Print "  |    | "
Print "  |    | "
Print "  |    | "

' Print the base of the rocket
Print "  /    \ "
Print " /      \ "
Print "/________\ "

' Print the exhaust flames
Print "   \  / "
Print "    \/ "

It seems like it can generate simple programs, although your mileage may vary depending on what you ask for! 
It would probably help if it had live access to the Internet (though I cringe to think of all the nefarious uses that could lead to!)


RE: program generated by chatgpt - James D Jarvis - 12-16-2022

(12-16-2022, 08:51 PM)madscijr Wrote:
(12-16-2022, 07:11 PM)James D Jarvis Wrote: create a qb64PE program listing that prints a rocket in ascii graphics

Code: (Select All)
' Print the top of the rocket
Print "    /\ "
Print "   /  \ "
Print "  /____\ "
Print "  \    / "

' Print the body of the rocket
Print "  |    | "
Print "  |    | "
Print "  |    | "

' Print the base of the rocket
Print "  /    \ "
Print " /      \ "
Print "/________\ "

' Print the exhaust flames
Print "   \  / "
Print "    \/ "

It seems like it can generate simple programs, although your mileage may vary depending on what you ask for! 
It would probably help if it had live access to the Internet (though I cringe to think of all the nefarious uses that could lead to!)

My son told me he watched a video where it was used to write a game using the UNITY engine. They did have to have it rework subroutines and it had trouble understanding the difference between the 2D engine and the 3D engine so there was some manual editing but it was functional.  Seemingly you just have to be patient and feed it information it can use.


RE: program generated by chatgpt - James D Jarvis - 12-16-2022

The world's worst image painter. I wish I'd kept track of the whole session. There was also a last second edit because I can't explain everything to the chat AI. It's probably a good thing it can't hear me curse.

Code: (Select All)
Dim image As _Unsigned Long
Dim s As _Unsigned Long
s = _NewImage(800, 600, 32)
Screen s

' Prompt the user to enter the width and height of the image
Print "Enter the width of the image: ";
Input ww
Print "Enter the height of the image: ";
Input hh

' Create a blank image with the specified dimensions
image = _NewImage(ww, hh)
' Set the initial color of the image to white
_Dest image
For x = 0 To width - 1
    For y = 0 To height - 1
        PSet (x, y), _RGB32(255, 255, 255)
    Next y
Next x

' Display the image on the screen
Cls
_PutImage (0, 0), image, 0
Sleep 1

' Loop until the user exits the program
Do
    _Dest s
    ' Prompt the user to enter the x and y coordinates of the pixel they want to change
    Print "Enter the x coordinate of the pixel to change: ";
    Input x
    Print "Enter the y coordinate of the pixel to change: ";
    Input y

    ' Prompt the user to enter the new color for the pixel
    Print "Enter the red value (0-255): ";
    Input red
    Print "Enter the green value (0-255): ";
    Input green
    Print "Enter the blue value (0-255): ";
    Input blue

    ' Update the color of the pixel
    _Dest image
    PSet (x, y), _RGB32(red, green, blue)
    _Dest 0

    ' Redraw the image on the screen
    _PutImage (0, 0), image, s

    ' Prompt the user to enter 'q' to exit or any other key to continue
    Print "Press 'q' to quit or any other key to continue: ";
    Input kkey$
Loop Until kkey$ = "q"