Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ChatGPT
#4
(02-22-2023, 12:38 AM)Sprezzo Wrote: Does this program make anything but a black screen on anyone else's machine?

ChatLGBT is nothing but fancy autocomplete. There, you heard my side first, ha.

Yep, it makes a few mistakes here and there but it's quite interesting that it can do this. I also asked it to generate a subroutine to rotate an image and another function to perform a rotozoom. Each needed slight modifications that needed to be made but the answers were otherwise solid.

Here is the image rotation it came up with:

Code: (Select All)
' Subroutine to rotate an image in QB64
SUB RotateImage(img AS _UNSIGNED _BYTE Ptr, width AS _INTEGER, height AS _INTEGER, degrees AS _INTEGER)
    ' Calculate the sine and cosine of the rotation angle
    rad = degrees * 3.14159 / 180
    cosA = COS(rad)
    sinA = SIN(rad)

    ' Create a new temporary image buffer
    newImg AS _UNSIGNED _BYTE Ptr = _NEWIMAGE(width, height)

    ' Loop through each pixel in the original image
    FOR x = 0 TO width - 1
        FOR y = 0 TO height - 1
            ' Calculate the new position of the pixel after rotation
            newX = x * cosA - y * sinA
            newY = x * sinA + y * cosA

            ' Check if the new position is within the bounds of the image
            IF newX >= 0 AND newX < width AND newY >= 0 AND newY < height THEN
                ' Get the color of the pixel at the new position
                color = _GETIMAGE(img, newX, newY)

                ' Set the color of the corresponding pixel in the new image buffer
                _PUTIMAGE(newImg, x, y, color)
            END IF
        NEXT y
    NEXT x

    ' Copy the rotated image back into the original image buffer
    _PUTIMAGE(img, 0, 0, newImg)

    ' Free the temporary image buffer
    _FREEIMAGE(newImg)
END SUB

And its explanation:

To use this subroutine, you would pass in a pointer to the image buffer, as well as the width and height of the image and the number of degrees to rotate the image by. The subroutine would create a new temporary image buffer, loop through each pixel in the original image, calculate its new position after rotation, and set the color of the corresponding pixel in the new image buffer. Finally, the subroutine would copy the rotated image back into the original image buffer and free the temporary image buffer.

Do you see "AI" models like this a threat or enhancement for programmers? I can see both sides. For an experienced programmer this may generate new ideas. For a beginner this could become a crutch and a path that never leads to actually mastering a language.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
ChatGPT - by TerryRitchie - 02-21-2023, 11:51 PM
RE: ChatGPT - by Sprezzo - 02-22-2023, 12:38 AM
RE: ChatGPT - by TerryRitchie - 02-22-2023, 01:47 AM
RE: ChatGPT - by bplus - 02-22-2023, 01:27 AM
RE: ChatGPT - by TerryRitchie - 02-22-2023, 01:52 AM
RE: ChatGPT - by mnrvovrfc - 02-22-2023, 02:57 AM
RE: ChatGPT - by TerryRitchie - 02-22-2023, 04:09 AM
RE: ChatGPT - by bplus - 02-22-2023, 03:16 AM
RE: ChatGPT - by PhilOfPerth - 07-12-2023, 06:15 AM
RE: ChatGPT - by mnrvovrfc - 02-22-2023, 05:26 AM
RE: ChatGPT - by madscijr - 02-23-2023, 10:36 PM
RE: ChatGPT - by Dimster - 02-22-2023, 05:16 PM
RE: ChatGPT - by mnrvovrfc - 02-23-2023, 02:35 AM
RE: ChatGPT - by aurel - 02-23-2023, 05:16 PM
RE: ChatGPT - by bplus - 02-23-2023, 08:19 PM
RE: ChatGPT - by SpriggsySpriggs - 02-23-2023, 08:37 PM
RE: ChatGPT - by TerryRitchie - 02-23-2023, 08:56 PM
RE: ChatGPT - by madscijr - 02-23-2023, 10:39 PM
RE: ChatGPT - by TerryRitchie - 02-23-2023, 10:54 PM
RE: ChatGPT - by madscijr - 02-23-2023, 11:06 PM
RE: ChatGPT - by mnrvovrfc - 02-23-2023, 11:53 PM
RE: ChatGPT - by madscijr - 02-24-2023, 12:37 AM
RE: ChatGPT - by bplus - 02-24-2023, 01:22 AM
RE: ChatGPT - by mnrvovrfc - 02-23-2023, 11:49 PM
RE: ChatGPT - by James D Jarvis - 02-23-2023, 08:49 PM
RE: ChatGPT - by DANILIN - 04-29-2023, 06:35 PM
RE: ChatGPT - by madscijr - 04-29-2023, 07:07 PM
RE: ChatGPT - by mnrvovrfc - 04-29-2023, 10:41 PM
RE: ChatGPT - by mnrvovrfc - 05-02-2023, 07:38 PM
RE: ChatGPT - by Dimster - 05-03-2023, 01:31 PM
RE: ChatGPT - by madscijr - 05-03-2023, 02:25 PM
RE: ChatGPT - by Dimster - 05-03-2023, 03:53 PM
RE: ChatGPT - by madscijr - 05-03-2023, 05:02 PM
RE: ChatGPT - by mnrvovrfc - 05-03-2023, 05:55 PM
RE: ChatGPT - by Ultraman - 05-03-2023, 05:41 PM
RE: ChatGPT - by madscijr - 05-03-2023, 06:07 PM
RE: ChatGPT - by TerryRitchie - 05-03-2023, 08:43 PM
RE: ChatGPT - by madscijr - 07-11-2023, 08:44 PM
RE: ChatGPT - by SMcNeill - 07-11-2023, 09:45 PM
RE: ChatGPT - by SpriggsySpriggs - 07-12-2023, 11:57 AM
RE: ChatGPT - by madscijr - 07-12-2023, 12:17 PM
RE: ChatGPT - by Kernelpanic - 07-15-2023, 08:46 PM
RE: ChatGPT - by madscijr - 07-15-2023, 11:24 PM
RE: ChatGPT - by SpriggsySpriggs - 07-16-2023, 12:34 AM
RE: ChatGPT - by madscijr - 07-16-2023, 06:40 PM
RE: ChatGPT - by mnrvovrfc - 07-16-2023, 07:37 PM
RE: ChatGPT - by madscijr - 07-17-2023, 02:44 AM
RE: ChatGPT - by SpriggsySpriggs - 07-17-2023, 02:33 PM



Users browsing this thread: 14 Guest(s)