English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 01 February 2023, 22:58   #1
JOB
Registered User
 
JOB's Avatar
 
Join Date: Jan 2023
Location: Nice, France
Age: 55
Posts: 13
chatGPT to write Amiga C code

A colleague of mine was playing with chatGPT today. As he was looking for some challenging questions, I told him to ask chatGPT to create an Amiga C program opening a window. He got the below answer:


#include <intuition/intuition.h>

int main() {
struct Window *window;
struct Screen *screen;

screen = OpenScreenTags(NULL,
SA_DisplayID, 0x50051000,
SA_Title, "My First Window",
SA_Width, 640,
SA_Height, 480,
SA_Depth, 3,
TAG_END);

if (screen == NULL) {
// Screen opening failed, handle error
return 1;
}

window = OpenWindowTags(NULL,
WA_Left, 0,
WA_Top, 0,
WA_Width, 640,
WA_Height, 480,
WA_IDCMP, IDCMP_CLOSEWINDOW,
WA_Title, "My First Window",
WA_Activate, TRUE,
WA_SmartRefresh, TRUE,
WA_NoCareRefresh, TRUE,
WA_GimmeZeroZero, TRUE,
WA_CloseGadget, TRUE,
WA_DepthGadget, TRUE,
TAG_END);

if (window == NULL) {
// Window opening failed, handle error
CloseScreen(screen);
return 1;
}

// Main event loop
while (1) {
ULONG signals = Wait(0L);
if (signals & SIGBREAKF_CTRL_C) {
break;
}
}

CloseWindow(window);
CloseScreen(screen);
return 0;
}



Maybe in the future we'll use this tool to create new Amiga programs!
JOB is offline  
Old 02 February 2023, 03:53   #2
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
When it comes to programming you should ask the same question a few times, and then compare the answers and laugh (well, you can do that right after the first answer).
a/b is offline  
Old 02 February 2023, 07:26   #3
TCD
HOL/FTP busy bee
 
TCD's Avatar
 
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 31,518
Yay, now we have three threads about the topic.
TCD is offline  
Old 02 February 2023, 13:32   #4
Ian
Global Moderator
 
Ian's Avatar
 
Join Date: May 2001
Location: Derby, UK
Age: 46
Posts: 2,287
I love it when people post like they're the first person to do something in the world ever lol.

Anyway, convos will get lost in a merge, so will leave the separate threads for now
Ian is offline  
Old 02 February 2023, 15:44   #5
drHirudo
Amiga user
 
drHirudo's Avatar
 
Join Date: Nov 2008
Location: Sofia / Bulgaria
Posts: 455
This thread was started by chatGPT powered bot!
drHirudo is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
code generated by ChatGPT ara Coders. System 29 15 June 2023 04:31
Can write Amiga Bootblock PC? Retro1234 support.Other 8 10 June 2019 18:15
HW banging IDE harddisk read/write asm source code (FFS/OFS) jotd Coders. Asm / Hardware 1 19 August 2018 13:09
Best way to write native code? arodgers support.FS-UAE 4 02 September 2016 19:53
So, I'd like to write a new Amiga game - what do you want to see? Graham Humphrey Amiga scene 88 26 February 2012 21:50

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:52.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08592 seconds with 13 queries