NO

Author Topic: ChatGPT examples  (Read 2633 times)

Offline Vortex

  • Member
  • *
  • Posts: 729
    • http://www.vortex.masmcode.com
ChatGPT examples
« on: April 01, 2023, 09:52:58 PM »
Hello,

Here are some Win32 control examples coded by ChatGPT. Some minor modifications were necessary before compiling the code with Pelles C.
« Last Edit: April 01, 2023, 10:10:40 PM by Vortex »
Code it... That's all...

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: ChatGPT examples
« Reply #1 on: April 02, 2023, 03:18:22 PM »
Probably just me, but I find it somewhat reassuring than an actual person was needed to make it work...  ;)
/Pelle

Offline Vortex

  • Member
  • *
  • Posts: 729
    • http://www.vortex.masmcode.com
Re: ChatGPT examples
« Reply #2 on: April 02, 2023, 07:10:33 PM »
Hi Pelle,

You are right, the coders are training the artificial engine by supplying the necessary code templates.

Here is another example, a bouncing window.
Code it... That's all...

Offline Vortex

  • Member
  • *
  • Posts: 729
    • http://www.vortex.masmcode.com
Re: ChatGPT examples
« Reply #3 on: April 13, 2023, 09:41:18 PM »
Hello,

Attached is a treeview example.
Code it... That's all...

Offline John Z

  • Member
  • *
  • Posts: 736
Re: ChatGPT examples
« Reply #4 on: April 14, 2023, 11:18:17 AM »
Thank Vortex,

These are interesting examples even if simple.
They might look a lot like MS example code....

I, for one, would like to know how much fix-up
work you had to do to get them to work. You mentioned
in the first example that some adjustment was needed.

Making the treeview more involved, can it create a
treeview display of any selected directory and all subdirectories
under it?  Just wondering how complex the request can be and
if it handles a real world example.

John Z

Offline Vortex

  • Member
  • *
  • Posts: 729
    • http://www.vortex.masmcode.com
Re: ChatGPT examples
« Reply #5 on: April 17, 2023, 09:04:00 PM »
Hi John,

Here are the steps to fix the progress bar sample :

- Add #include <commctrl.h> to define PROGRESS_CLASS

- Practical solution : move int nProgress = 0;  to the top of the code - static storage classe definiton in the original code.

- Initialize the missing timer :  SetTimer(hwnd, ID_TIMER, 50, NULL);

Asking ChatGPT to design a more sophisticated treeview example failed, the AI suddenly stopped typing the code after some progress :

Code: [Select]
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_SIZE:
        // Resize treeview control to fit window
        MoveWindow(GetDlgItem(g_hWnd, WC_TREEVIEW), 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
        break;
    case WM_NOTIFY:
        if (((LPNMHDR)lParam)->code == TVN_ITEMEXPANDING)
        {
            // Populate subfolders when a node is expanded
            LPNMTREEVIEW lpnmtv = (LPN
}

No code after the last line.
Code it... That's all...


Offline John Z

  • Member
  • *
  • Posts: 736
Re: ChatGPT examples
« Reply #7 on: April 18, 2023, 12:17:40 AM »
Very interesting!

Thanks Vortex.

John Z

Offline Vortex

  • Member
  • *
  • Posts: 729
    • http://www.vortex.masmcode.com
Re: ChatGPT examples
« Reply #8 on: April 18, 2023, 08:44:53 PM »
Hi John,

You are welcome. To get the continuation of the ChatGPT coding session, I simply type :

Quote
continue

Attached is a Mandelbrot fractal example.
Code it... That's all...

Offline John Z

  • Member
  • *
  • Posts: 736
Re: ChatGPT examples
« Reply #9 on: April 21, 2023, 11:42:17 AM »
Thanks Vortex,

Got it to look over.

Here is an interesting take on ChatGPT code.

https://www.theregister.com/2023/04/21/chatgpt_insecure_code/

John Z

Offline Vortex

  • Member
  • *
  • Posts: 729
    • http://www.vortex.masmcode.com
Re: ChatGPT examples
« Reply #10 on: April 21, 2023, 08:40:54 PM »
Hi John,

Thanks for the article. Something is not clear, are the research results based on the free or paid ChatGPT service? Also, it's probably early yet to expect secure programming from ChatGPT as it's a very new AI system.
Code it... That's all...

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2073
Re: ChatGPT examples
« Reply #11 on: April 22, 2023, 04:56:26 PM »
ChatGPT use the information he has processed from huge web data.
Most of programming examples on the web are just simplified samples of programming techniques that, for the sake of simplicity, normally ignore complications related to safety and efficiency.
Maybe asking to it if the code is safe, efficient, etc. The machine can upgrade the code. But to what extent?
You'll never know when, and if, what is output is really correct, unless yourself are an expert; but if you are such an expert why ask to ChatGPT?
I asked many technical questions about programming, uC, embedded controls, the answer were almost always incomplete, if not wrong. I had to add "Are you sure? The datasheet says something different." The answer was almost always "You're right, I'm sorry" (sometime insisting on the error).
How many times we must re-ask to be sure that it had correctly processed all the available data? And how we know if the answer is finally correct? What if base data was itself wrong?
So in MHO it is nice to play around with ChatGPT, but it will still take a long time for ChatGPT to be trusted...
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: ChatGPT examples
« Reply #12 on: April 23, 2023, 10:14:56 AM »
The AI bot learns how a child learns with trial and error.
Due to the speed it can learn it will not take a whole life to get to a knowledge level of a human.
On the other side there is not only bare knowledge in a humans world, but that part might be out of scope for a bot.
---
Stefan

Proud member of the UltraDefrag Development Team

Offline Vortex

  • Member
  • *
  • Posts: 729
    • http://www.vortex.masmcode.com
Re: ChatGPT examples
« Reply #13 on: April 23, 2023, 11:40:09 AM »
On the other side there is not only bare knowledge in a humans world, but that part might be out of scope for a bot.

Exactly. For example, intuition :

Quote
the ability to understand something instinctively, without the need for conscious reasoning.

At the moment, this is something that an AI cannot "understand".
Code it... That's all...

Offline John Z

  • Member
  • *
  • Posts: 736
Re: ChatGPT examples
« Reply #14 on: April 23, 2023, 01:07:32 PM »
Probably a good topic to move to Chit-Chat  :)

Anyway it is more realistic to name it simulated intelligence IMHO.  SI rather than AI, and it is a very limited simulation at that as both Vortex and Stefan have pointed out.  It is stuck doing what it was instructed to do and how it was instructed to do it, by the algorithms within.  Having almost unlimited memory access does not equal intelligence, superior or otherwise.  A person with an eidetic memory can recall anything seen, and there are those that can recall any moment in their life, hyperthymesia, but these people are not characterized as super intelligence or extremely high IQ as defined today.  An "AI" that beat everyone at the game of GO because it was trained extensively on the game and the only purpose of the 'AI' was to win, initially succeeded in beating the worlds best human GO player.... but eventually it also lost a game because a human thought of a unique strategy enabling a win.  The 'AI' could not and did not 'foresee' the strategy.

John Z

P.S. An excellent SiFi series,or two, with Sentient Aware Digital Entities (SADE's) by S.H.Jucha
Silver Ships and Gate Ghosts
https://scottjucha.com/silverships.html