Software > Coding

ChatGPT schreibt ein GEM-Programm

(1/3) > >>

mfro:
ich finde das fast ein bißchen unheimlich...

Fast noch ein wenig unheimlicher finde ich, dass ChatGPT auch ein GEM-Programm in Ada schreibt, obwohl es meines Wissens nach nie einen Ada-Compiler (und schon gar kein GEM-Binding) für den ST gab:


--- Code: ---with Ada.Text_IO; use Ada.Text_IO;
with System;
with Atari.AES;
with Atari.VDI;

procedure Main is
   -- AES and VDI handles
   WHandle : System.Address;
   VHandle : System.Address;

   -- AES and VDI parameters
   WSpec   : AES.WSpec;
   VSpec   : VDI.VSpec;

   -- AES and VDI workstations
   AES_Work : AES.Workstation_Type;
   VDI_Work : VDI.Workstation_Type;

   -- AES event buffer
   Event : AES.Event;

   -- Rectangle coordinates
   X1, Y1, X2, Y2 : Integer;
begin
   -- Initialize AES and VDI
   AES.Init;
   VDI.Init;

   -- Open a full-screen AES window
   WSpec.Kind        := AES.Wind_Full;
   WSpec.Title       := To_AES_String("My AES Window");
   WSpec.Handle      := System.Null_Address;
   WSpec.X, WSpec.Y  := 0, 0;
   WSpec.W, WSpec.H  := AES.Desktop_Width, AES.Desktop_Height;
   WSpec.KindOfWork  := AES.AES_Work;
   WHandle := AES.Open_Workstation(WSpec);
   AES_Work := AES.To_Workstation(WHandle);

   -- Open a VDI workstation for the AES window
   VSpec.Handle    := WHandle;
   VSpec.Device    := VDI.Screen;
   VSpec.Format    := VDI.Pixel;
   VSpec.Points    := AES.Desktop_Resolution;
   VSpec.Ratio     := VDI.Square;
   VHandle := VDI.Open_Workstation(VSpec);
   VDI_Work := VDI.To_Workstation(VHandle);

   -- Set the background color to black
   VDI.Background_Color(VDI_Work, VDI.Black);

   -- Draw a red rectangle in the middle of the window
   X1 := AES.Desktop_Width div 4;
   Y1 := AES.Desktop_Height div 4;
   X2 := AES.Desktop_Width * 3 div 4;
   Y2 := AES.Desktop_Height * 3 div 4;
   VDI.Rectangle(VDI_Work, X1, Y1, X2, Y2);
   VDI.Interior_Style(VDI_Work, VDI.Solid, VDI.Red);
   VDI.Draw_Filled(VDI_Work, 1, (X1, Y1, X2, Y2));
   
   -- Wait for the window to be closed
   loop
      AES.Get_Event(Event);
      exit when Event.Kind = AES.Wind_Closed;
   end loop;

   -- Close the AES and VDI workstations
   AES.Close_Workstation(WHandle);
   VDI.Close_Workstation(VHandle);

   -- Exit AES and VDI
   AES.Exit

--- Ende Code ---

Thorsten Otto:
Lustig. Schon mal mit fortran oder Cobol versucht?

Komm leider momentan nicht auf die Seite, Server scheint überlastet zu sein.

czietz:
Ein Problem mit ChatGPT ist, dass es sehr selten sagt "tut mir leid, weiß ich nicht". Lieber fabuliert es sich eine gut klingende aber falsche Antwort zusammen. Siehe das folgende Beispiel. Zumindest in den GFA-Basic-Versionen, die ich kenne, gibt es keinen Befehl MESSAGE. (Eine Message-Box bekäme man mit ALERT.)



czietz:
Oder das hier, an dem so ungefähr alles falsch ist.  :D

Thorsten Otto:
Vermutlich weiss es überhaupt nichts über GFA, und hat nur "Basic" gelesen. Zeilen-Nummern gibt es in GFA ja auch nicht.

Edit: wie es auf die merkwürdige Ideen mit rwabs kommt ist mir allerdings schleierhaft ;)

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln