06 December 2022, 13:17 | #1 |
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
code generated by ChatGPT
Here is then answer ChatGPT gave when I asked for a window with the text "hello world" in red and when the user clicks on the text, it should play a sine wave sound with 200kHz (yes, that was my mistake). Fascinating how it invents new OS functions
Code:
#include <stdio.h> #include <proto/intuition.h> #include <proto/graphics.h> #include <proto/exec.h> #include <proto/dos.h> #define WIDTH 300 #define HEIGHT 200 struct Window *win; void cleanup() { if (win) CloseWindow(win); CloseLibrary(IntuitionBase); CloseLibrary(GfxBase); CloseLibrary(DOSBase); } void handle_click() { // create a sine-wave audio sample with 200KHz frequency int samples = 44100; int16_t data[samples]; for (int i = 0; i < samples; i++) { data[i] = (int16_t)(32767.0 * sin(2.0 * M_PI * i * 200000.0 / 44100.0)); } // open the audio device struct IOAudio *audioIO = (struct IOAudio*)AudioIOInit(); if (!audioIO) return; // set the audio format audioIO->ioa_Request.io_Command = ADCMD_ALLOCATE; audioIO->ioa_DataFormat = ADFMT_S16_NE; audioIO->ioa_Frequency = 44100; audioIO->ioa_Volume = 0x10000; audioIO->ioa_Channels = 1; audioIO->ioa_MixFreq = 44100; if (OpenDevice(AUDIONAME, 0, (struct IORequest*)audioIO, 0) != 0) { AudioIOFree(audioIO); return; } // play the audio sample audioIO->ioa_Request.io_Command = CMD_WRITE; audioIO->ioa_Request.io_Data = data; audioIO->ioa_Request.io_Length = samples * 2; audioIO->ioa_Request.io_Offset = 0; AO_PlaySamples(audioIO); // wait for the audio sample to be played while (audioIO->ioa_Request.io_Message.mn_Node.ln_Type != NT_MESSAGE) { Wait(1 << audioIO->ioa_Request.io_Message.mn_ReplyPort->mp_SigBit); } // close the audio device CloseDevice((struct IORequest*)audioIO); AudioIOFree(audioIO); } int main() { if (!(IntuitionBase = OpenLibrary("intuition.library", 39))) return 1; if (!(GfxBase = OpenLibrary("graphics.library", 39))) return 1; if (!(DOSBase = OpenLibrary("dos.library", 39))) return 1; atexit(cleanup); win = OpenWindowTags(NULL, WA_Left, 0, WA_Top, 0, WA_Width, WIDTH, WA_Height, HEIGHT, WA_Title, (ULONG)"Hello world", WA_IDCMP, IDCMP_CLOSEPATTERN | IDCMP_MOUSEBUTTONS, WA_Flags, WFLG_CLOSEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_ACTIVATE, WA_Gadgets, NULL, TAG_DONE); if (!win) return 1; SetRast(win->RPort, 0x000000FF); // set the text color to red Move(win->RPort, 20, 20); Text(win->RPort, "Hello world", strlen("Hello world")); struct IntuiMessage *msg; ULONG msg_class; while (1) { WaitPort(win->UserPort); while (msg = (struct IntuiMessage*)GetMsg(win->UserPort)) { msg_class = msg->Class; ReplyMsg((struct Message*)msg); if (msg_class == IDCMP_MOUSEBUTTONS) { // handle click on the text handle_click(); } else if (msg_class == IDCMP_CLOSEPATTERN) { break; } } if (msg_class == IDCMP_CLOSEPATTERN) break; } return 0; } Last edited by ara; 06 December 2022 at 14:48. |
06 December 2022, 16:35 | #2 |
Semi-Retired
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 2,047
|
Wow!
What was the exact question you asked? |
06 December 2022, 18:30 | #3 |
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
I don't remember anymore the exact words, but it was similar to this: "Write a program in C for AmigaOS to open a window that shows the text "Hello World" in red and when you click on the text it plays a sine wave audio sample with 220KHz [sic]".
I first did a query without the audio sample part and the produced code even checked whether the mouse click was inside the bounds of the "Hello world" text. It is very good at producing things that look correct at first glance. I am wondering where it got the non-existing stuff like IDCMP_CLOSEPATTERN from. |
06 December 2022, 22:17 | #4 |
Registered User
Join Date: Feb 2016
Location: London
Posts: 349
|
Looks quite amazing!
|
06 December 2022, 22:20 | #5 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,380
|
Amazing but non functional and fake.
ChatGPT please make me some chinese 060 cpus please |
08 January 2023, 04:00 | #6 | |
Registered User
|
Quote:
Was the name of the damn function AllocMem or AllocMemory you know... Also don't forget that ChatGPT doesn't try to run WinUAE, compile the code and actually test it and therefore can't start the continuous development process involving fixing bugs over time. Considering those limitations, this result is really amazing! EDIT: Did you try what happens, when you reply to ChatGPT something like this: "Your example is pretty good, however IDCMP_CLOSEPATTERN does not exist. Maybe you could try again?" Last edited by BastyCDGS; 08 January 2023 at 04:06. Reason: Added idea for further investigation |
|
09 January 2023, 14:34 | #7 |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,888
|
This show that "AI" is not aware of the concept Nyquist frequency and Nyquist rate i.e. there is no I behind A except capability of mimicry behind words... This remains me modern media where people pretending they are technical experts when mixing pentagram with pantograph or modern politicians...
|
09 January 2023, 21:17 | #8 |
Returning fan!
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,440
|
Hi!
Interesting experiment Also, the bot is not learning: "teach" it something in one session, for example that "AmiModRadio allows downloading modules from Web sites to play them on your local Amiga", create a new session, and ask it about AmiModRadio... Definitely no "I" Cheers! |
15 February 2023, 12:55 | #9 | |
Registered User
Join Date: Aug 2010
Location: Germany
Posts: 537
|
Quote:
That said, the function calls which are supposed to play back the sound and free the audio resources likely came from a program which contains these in a separate file. ChatGPT combines information to produce sequences of plausible items in context. Hence, ChatGPT might not have picked them up and reproduced them because they were not sufficiently plausible. |
|
15 February 2023, 13:20 | #10 | |
Ex nihilo nihil
Join Date: Oct 2017
Location: CH
Posts: 5,057
|
Quote:
ChatGPT should better reply that it doesn't know instead of writing such things (until it knows). |
|
15 February 2023, 16:07 | #11 |
Returning fan!
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,440
|
Hi all!
I was actually impressed by the code generated in answer to "Write a C program for AmigaOS to list all devices and volumes." over the week-end, it had generate a nice piece of code. The problem is that it generates crappy code today. It's not consistent! Cheers! |
16 February 2023, 01:08 | #12 |
Registered User
Join Date: Jan 2015
Location: australia
Posts: 534
|
Interesting watch --
[ Show youtube player ]
|
21 March 2023, 18:01 | #13 | |
Registered User
|
Hi malko!
Quote:
The truly amazing thing about ChatGPT is the language model, i.e. that you can talk to it almost like to another human (including complex speech) and still understanding what you expect from the AI. However, in detail, the results often contain mistakes, so blind trust is never recommended. Also remember that Amiga stuff is a niche and therefore is not that much training data for the AI available. |
|
21 March 2023, 22:19 | #14 |
cheeky scoundrel
Join Date: Nov 2004
Location: Spijkenisse/Netherlands
Age: 43
Posts: 6,978
|
|
04 April 2023, 15:31 | #15 |
Registered User
|
For all those, who don't have a ChatGPT account, you can test it out for free and without registration here (using GPT-3.5-Turbo engine):
https://seoschmiede.at/chatgpt Please note, that while the page is in german, you can still ask ChatGPT english and other language questions. If you want to test without context, you can input your question to ChatGPT at: "Was ist deine Frage?" and click the green button right to it "Frage stellen ->" in order to submit your query. If you want to try with context, click on: Neuer Chatbot (mit Verlauf) -> Then type your query in the left field where the button "Los ->" is and click "Los ->" to submit the query. Please note that the free version is limited to processing 1000 tokens at max per query. Also note that using ChatGPT is NOT free for the site owner, so please do not ask way too many questions. Have fun! Example: Question from me: Simulate creation of a virtual AD&D character, using your PRNG to simulate the dice rolls, choosing a name, gender, race and class yourself! Show the virtual character sheet! Now begin simulating a virtual combat against a Beholder while explaining the AD&D combat rules step by step , also showing virtual PRNG dice results. Show a summary of all involved entities at begin of each combat round! Reply from ChatGPT: Sure, I can assist you with that. Let's start by creating a virtual AD&D character. Name: Thorgar Gender: Male Race: Dwarf Class: Fighter Now, let's use my PRNG to simulate the dice rolls for Thorgar's abilities. Here are the results: Strength: 10 Dexterity: 16 Constitution: 12 Intelligence: 9 Wisdom: 13 Charisma: 8 Based on these results, Thorgar's sheet looks like this: Character sheet: ------------------ Name: Thorgar Gender: Male Race: Dwarf Class: Fighter ------------------ Ability scores: Strength: 10 Dexterity: 16 Constitution: 12 Intelligence: 9 Wisdom: 13 Charisma: 8 ------------------ Hit points: 10 Now, let's simulate a virtual combat against a Beholder. The Beholder is a fearsome creature with multiple eye-stalks, each capable of powerful magical attacks. Thorgar will need to be careful. Here's a summary of all the entities involved: Thorgar, Dwarf Fighter, Hp: 10 Beholder, Monster, Hp: 45 Round 1: Thorgar rolls initiative: 15 (10 + 5 from dexterity) Beholder rolls initiative: 10 Thorgar goes first. As a fighter, Thorgar has two attacks per round. He rolls to attack with his warhammer: 13 (7 + 3 from strength + 3 from proficiency). The Beholder's armor class is 18, so Thorgar misses. The Beholder retaliates by using its Eye Rays. It randomly chooses three eye rays to shoot at Thorgar. I'll use my PRNG to determine which eye rays are used. Eye ray 1: Disintegration Ray (2d6 damage if it hits) Eye ray 2: Sleep Ray (Thorgar must make a Wisdom saving throw or fall asleep) Eye ray 3: Paralyzing Ray (Thorgar must make a Dexterity saving throw or be paralyzed) I'll use my PRNG to simulate the accuracy and effects of each ray. Eye ray 1: 17 (against Thorgar's armor class of 15), hits. Damage: 7 (2d6). Thorgar takes 7 damage and his hit points are reduced to 3. Eye ray 2: 12 (against Thorgar's Wisdom saving throw DC of 13), misses. Thorgar is unaffected by the Sleep Ray. Eye ray 3: 21 (against Thorgar's Dexterity saving throw DC of 14), hits. Thorgar fails the saving throw and is paralyzed for one round. At the end of round 1, here's the summary of entities: Thorgar, Dwarf Fighter, Hp: 3 (Paralyzed) Beholder, Monster, Hp: 45 Round 2: Thorgar is paralyzed and cannot act this round. He'll need to make a saving throw at the end of his next turn to see if he can break free. The Beholder takes advantage of Thorgar's vulnerability and uses three Eye Rays again. Eye ray 1: 11, misses. Eye ray 2: 16, hits. Thorgar must make a Wisdom saving throw or fall asleep. Eye ray 3: 19, hits. Thorgar must make a Dexterity saving throw or be paralyzed. Using my PRNG to determine effect: Eye ray 2: 9, Thorgar fails his saving throw and falls asleep. Eye ray 3: 23, Thorgar fails his saving throw and is paralyzed for another round. At the end of round 2, here's the summary of entities: Thorgar, Dwarf Fighter, Hp: 3 (Asleep and Paralyzed) Beholder, Monster, Hp: 45 This combat looks pretty tough for Thorgar. He's been hit by two different Eye Rays and his hit points are getting low. It's possible that he could fall asleep soon, making him an easy target for the Beholder. I hope this helps to explain the AD&D combat rules and how to use a PRNG to simulate dice rolls. If you have any other questions, feel free to ask! Second try, almost same question: Simulate creation of a virtual AD&D level 17 character, using your PRNG to simulate the dice rolls, choosing a name, gender, race and class yourself! Show the virtual character sheet! Now begin simulating a virtual combat against a Beholder while explaining the AD&D combat rules step by step , also showing virtual PRNG dice results. Show a summary of all involved entities at begin of each combat round! Reply from ChatGPT: Sure, I can definitely help you with that. Let's create a level 17 AD&D character using my PRNG to simulate the dice rolls. Name: Arinelle Gender: Female Race: Half-Elf Class: Cleric Now, let's use the PRNG to simulate the ability scores for Arinelle. Here are the results: Strength: 15 Dexterity: 13 Constitution: 16 Intelligence: 12 Wisdom: 18 Charisma: 10 Based on these results, Arinelle's character sheet looks like this: Character sheet: ------------------ Name: Arinelle Gender: Female Race: Half-Elf Class: Cleric ------------------ Ability scores: Strength: 15 Dexterity: 13 Constitution: 16 Intelligence: 12 Wisdom: 18 Charisma: 10 ------------------ Hit points: 116 Now, let's simulate a virtual combat against a Beholder. This Beholder will be even tougher than the one in the previous simulation, so Arinelle will need to be at her best. Here's a summary of all the entities involved: Arinelle, Half-Elf Cleric, Hp: 116 Beholder, Monster, Hp: 80 Round 1: Arinelle rolls initiative: 18 (13 + 5 from dexterity) Beholder rolls initiative: 12 Arinelle goes first. As a cleric of level 17, Arinelle has three attacks per round. She rolls to attack with her mace: 33 (18 + 5 from strength + 10 from proficiency). The Beholder's armor class is 23, so Arinelle misses. The Beholder retaliates by using its Eye Rays. It randomly chooses three eye rays to shoot at Arinelle. I'll use my PRNG to determine which eye rays are used. Eye ray 1: Petrification Ray (Arinelle must make a Constitution saving throw or turn to stone) Eye ray 2: Fear Ray (Arinelle must make a Wisdom saving throw or be frightened) Eye ray 3: Enervation Ray (2d8 damage if it hits) I'll use my PRNG to simulate the accuracy and effects of each ray. Eye ray 1: 15 (against Arinelle's Constitution saving throw DC of 19), misses. Arinelle is unaffected by the Petrification Ray. Eye ray 2: 20 (against Arinelle's Wisdom saving throw DC of 18), hits. Arinelle is frightened until the end of her next turn. Eye ray 3: 27 (against Arinelle's armor class of 18), hits. Damage: 10 (2d8). Arinelle takes 10 damage and her hit points are reduced to 106. At the end of round 1, here's the summary of entities: Arinelle, Half-Elf Cleric, Hp: 106 (Frightened) Beholder, Monster, Hp: 80 Round 2: Arinelle is frightened and must use her action to move as far away as possible from the Beholder. The Beholder decides to move closer to Arinelle and use three Eye Rays. Eye ray 1: Telekinesis Ray (Arinelle must make a Strength saving throw or be moved 30 feet in a random direction) Eye ray 2: Paralyzing Ray (Arinelle must make a Dexterity saving throw or be paralyzed) Eye ray 3: Death Ray (Arinelle must make a Dexterity saving throw or take 10d10 damage) I'll use my PRNG to simulate the accuracy and effects of each ray. Eye ray 1: 22 (against Arinelle's Strength saving throw DC of 18), hits. Arinelle fails her saving throw and is moved 30 feet in a random direction. Eye ray 2: 11 (against Arinelle's Dexterity saving throw DC of 19), misses. Arinelle is unaffected by the Paralyzing Ray. Eye ray 3: 29 (against Arinelle's Dexterity saving throw DC of 19), hits. Arinelle fails her saving throw and takes 10d10 damage. I'll use my PRNG to simulate the damage from the Death Ray: 54. Arinelle takes 54 damage and her hit points are reduced to 52. At the end of round 2, here's the summary of entities: Arinelle, Half-Elf Cleric, Hp: 52 (Moved 30 feet, Frightened) Beholder, Monster, Hp: 80 This combat is even tougher than the previous one, and it's clear that Arinelle will need some luck if she wants to win. She's been hit by two different Eye Rays and her hit points are getting low. She'll need to use her spells wisely if she wants to stay alive. I hope this helps to explain the AD&D combat rules and how to use a PRNG to simulate dice rolls. Let me know if you have any other questions. Last edited by BastyCDGS; 04 April 2023 at 16:02. Reason: Added two examples |
04 April 2023, 16:11 | #16 |
Registered User
Join Date: Feb 2012
Location: United Kingdom
Posts: 3,190
|
ChatGPT
Please crack x game protection, thank you kindly. This will put @Stingray out of a job lol. |
04 April 2023, 16:20 | #17 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Thanks for the link, i could finally test it !
Now i know what they mean by "confidently wrong". I asked it if it knew places where it could be accessed without having to create an account and it only listed social media and openAI's website where it's obviously not... |
04 April 2023, 16:34 | #18 | |
Registered User
|
Hi!
Quote:
|
|
04 April 2023, 16:41 | #19 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
|
04 April 2023, 18:07 | #20 |
Global Moderator
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
|
The problem with the term Artificial Intelligence is misleading. To be intelligent it needs to be able to learn from input and mistakes. It does not so therefore it isn't intelligent. If it could learn from mistakes and input, and the input was shit... The intelligence would not work and with so many users giving input there would definitelyt be a lot that would intentionally give it incorrect information just to see what happens. It also doesn't understand right from wrong and there is no common sense.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
View Amos generated assembly code? | Brick Nash | Coders. AMOS | 7 | 01 May 2021 22:54 |
External interrupts generated by TCP/IP stacks | dissident | Coders. Asm / Hardware | 37 | 09 January 2019 10:27 |
Generated code for sprites | Zarchos | Coders. Asm / Hardware | 12 | 22 July 2017 20:40 |
Generated code and CPU Instruction Cache | Mrs Beanbag | Coders. Asm / Hardware | 11 | 23 May 2014 11:05 |
Games with generated levelcodes | Joe Maroni | Nostalgia & memories | 12 | 24 February 2013 01:23 |
|
|