AI vs HI

Anything QL Software or Programming Related.
User avatar
pjw
QL Wafer Drive
Posts: 1629
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

AI vs HI

Post by pjw »

The assembler problems I wanted GPT to solve were not QL-specific. The first task was a simple test: Write a 32bit by 32 bit multiplication routine in mc68k assembler. This it solved reasonably well AFAICS, although I havent actually tested the code. Clearly it was something it had seen before.

The next problem was something I had wasted a lot of time over trying to do myself: First I asked if it knew about Exif. It said it did, so then I asked it to write a general mc68k assembler routine to extract the timestamp from a jpeg (Exif is the industry standard convention for storing this kind of information in JPEGs and some other objects). I specified that the file would be in RAM pointed to by a1, and I wanted the result string to be placed in a buffer pointed to by a2. The problem was posed this way so as not to involve any QL-specific stuff. I intended to refine the problem definition depending on the result, and provide the QL interfacing myself.

The outcome was, as already indicated, pretty much nonsense. Thats as far as I got. Until today.

Just now I had another round with GPT trying to get the datestamp. I'll say this for it: It does learn. After a few rounds I got it to understand that 1) cmpm was not a legal instruction; cmp is, and neither is dbxx.s, 2) that my assembler complains of a bxx if a branch instruction could be short. It fixed that, but is clearly not able to calculate correctly as I still had to weed out a few bxxes. 3) It quickly learnt that addq and subq could only work with values of 0 to 8 (and not addq.l #10,d0 as it tried to do) and that moveq only works with byte sized values, which are then sign extended to a long word. 4) I had to tell it that my assembler doesnt accept spaces between arguments, eg move.l d1, d0 should be move.l d1,d0.

I dont know how long it will retain that learning. Perhaps other assemblers are ok with many of the "faults" I found and that Ive now polluted its "mind". It didnt remember me from our last session in February, so perhaps Ill have to do all these corrections again next time..

The end result, after a few hours so far, is code that compiles alright, and looks "normal", although not very efficient. But it also doesnt do the trick! I still cant get the timestamp, although I know its there! It has offered me a version that includes some debugging code. I'll try that some other time as Ive had enough for today.


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
User avatar
tofro
Font of All Knowledge
Posts: 3144
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: AI vs HI

Post by tofro »

pjw wrote: Thu Dec 12, 2024 5:04 pm I dont know how long it will retain that learning. Perhaps other assemblers are ok with many of the "faults" I found and that Ive now polluted its "mind". It didnt remember me from our last session in February, so perhaps Ill have to do all these corrections again next time..
To my understanding, ChatGPT sessions work on "islands" that are completely isolated and discarded once the session is closed (so, the "learning" is temporary and limited to a session. If you pay for a commercial license, you can opt to save the island for later re-use). This is due to possible IPR conflicts that are still a legal question unsolved. Imagine a Mercedes-Benz employee asks for a solution to a problem with a car of their making, ChatGPT provides an answer and will, the next day, (likely not deliberately) provide some of the internal Merc knowledge it has gained to a BMW guy.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Derek_Stewart
Font of All Knowledge
Posts: 4790
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: AI vs HI

Post by Derek_Stewart »

maybe ChatGPT is not worth the effort for QL.

Mayb a ChatQL is required.


Regards, Derek
User avatar
Pr0f
QL Wafer Drive
Posts: 1579
Joined: Thu Oct 12, 2017 9:54 am

Re: AI vs HI

Post by Pr0f »

Public chat GPT has a 'memory' of about 2-3 weeks, plus whatever it can find on a general search of the internet - it's kind of a large library that it can use!

The last place I worked, we had an internal engine alongside the public AI - that could be trained on internal knowledge, corrected, and had a much longer term memory - but was specifically aimed at support troubleshooting for the product. It was quite powerful in conjuction with the public AI engine, and could provide answers both product specific and those areas that cross products and include other companies offerings and interactions with our product,


User avatar
dilwyn
Mr QL
Posts: 3131
Joined: Wed Dec 01, 2010 10:39 pm

Re: AI vs HI

Post by dilwyn »

The examples I posted were for ZX Spectrum (1 refinement to original question to Gemini) and the "QL" listing was a second refinement where I asked it to convert the Spectrum listing to Sinclair QL SuperBASIC.

Perhaps a more carefully phrased original query might have produced a better start point.

For someone who is not too confident in Basic programming, it might provide some starting point to learning. Ask it to make you a simple program, then use that as a learning tool. Make it work, then improve it. Rather like we used to, typing in example listings from the manual at first then going on to type in magazine listings, which often didn't work first time. So you quickly learned a lot, finding your own typos to get the thing to work.

It might also be useful for quickly generating the simplest of programs as a base to work from if you're not too sure of an algorithm, for example.


Derek_Stewart
Font of All Knowledge
Posts: 4790
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: AI vs HI

Post by Derek_Stewart »

HI

There is always QChatAI by AFX: viewtopic.php?p=54569#p54569


Regards, Derek
stevepoole
Aurora
Posts: 898
Joined: Mon Nov 24, 2014 2:03 pm

Re: AI vs HI

Post by stevepoole »

Hi Folks,
Fascinated at the thought that IA could write QL Code, I asked COPILOT for a Mandelbrot.
And this is the reply :
100 WINDOW #1, 512, 256 : PAPER #1,0 : INK #1, 3 : CLS #1 110 FOR y= -128 TO 127 120 FOR x= -256 TO 255 130 LET a= x / 128 140 LET b= y / 128 150 LET ca= a 160 LET cb= b 170 LET i= 0 180 DO WHILE i < 50 AND (a*a + b*b) <= 4 190 LET t= a*a - b*b + ca 200 LET b= 2*a*b + cb 210 LET a= t 220 LET i= i+1 230 LOOP 240 IF (a*a + b*b) <= 4 THEN PLOT x+256, y+128 250 NEXT x 260 NEXT
Not useable a such, but with a little transformation, this is the output on QPC2 : Steve.
Capture d’écran (672).png


User avatar
pjw
QL Wafer Drive
Posts: 1629
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: AI vs HI

Post by pjw »

Hi Steve,

I think you wont find much "I" in the AI that produced this. It probably just nicked it from some student's computer class copybook.

Like you, I took the trouble of testing it out, just for the hell of it. So heres an SBASIC version of the same program:

Code: Select all

100 ch = FOPEN("con")
102 mxx% = SCR_XLIM(#ch): mxy% = SCR_YLIM(#ch)
104 mx% = mxx% DIV 2: my% = mxy% DIV 2
106 WINDOW #ch, mxx%, mxy%, 0, 0
108 PAPER #ch, 0 : CLS #ch
110 col = 3: 		rem Change colour to taste
112 FOR y = -my% TO my% - 1
114  FOR x = -mx% TO mx% - 1
116   LET a = x / my%
118   LET b = y / my%
120   LET ca = a
122   LET cb = b
124   LET i = 0
126   :
128   REPeat loop
130    aa = a*a: bb = b*b
132    IF i < 50 AND (aa + bb) <= 4 THEN
134     LET t = aa - bb + ca
136     LET b = 2*a*b + cb
138     LET a = t
140     LET i = i + 1
142    ELSE
144     EXIT loop
146    END IF
148   END REPeat loop
150   :
152   IF (aa + bb) <= 4 THEN BLOCK#ch; 1, 1, x + mx%, y + my%, col
154  END FOR x
156 END FOR y
158 BEEP 2000, 2
160 PAUSE#ch


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
User avatar
pjw
QL Wafer Drive
Posts: 1629
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: AI vs HI

Post by pjw »

Going slightly off-topic here. If anyone is interested perhaps move to another thread or revive an old one..

Thought Id make the Mandelbrot thingy a wee bit more SBASIC-specific and then have a play with it:

Code: Select all

100 ch = FOPEN("con")
110 scrx% = SCR_XLIM(#ch): scry% = SCR_YLIM(#ch)
120 x2% = scrx% DIV 2: y2% = scry% DIV 2
130 WINDOW #ch; scrx%, scry%, 0, 0
140 PAPER #ch, 0 : CLS #ch
150 col = 3
160 FOR y% = -y2% TO y2% - 1
170  FOR x% = -x2% TO x2% - 1
180   a = x% / y2%
190   b = y% / y2%
200   ca = a
210   cb = b
220   :
230   FOR i% = 0 TO 50
240    aa = a*a: bb = b*b: ab = aa + bb
250    IF ab > 4: EXIT i%
260    t = aa - bb + ca
270    b = 2*a*b + cb
280    a = t
290   END FOR i%
300   :
310   IF ab <= 7 THEN BLOCK#ch; 1, 1, x% + x2%, y% + y2%, ab:         REMark Multi coloured
320   REMark IF ab <= 4 THEN BLOCK#ch; 1, 1, x% + x2%, y% + y2%, col:    REMark Original
330   REMark IF ab > 4 THEN BLOCK#ch; 1, 1, x% + x2%, y% + y2%, col:     REMark Inverted
340  END FOR x%
350  IF KEYROW(1) = 8: EXIT y%: REMark ESC
360 END FOR y%
370 BEEP 2000, 2
380 PAUSE#ch
Just EXecute the SBASIC file. Press ESC if you get bored. Swap around the REMarks (lines 310-330) to try two other variations, and experiment yourselves if you feel so inclined..


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
User avatar
pjw
QL Wafer Drive
Posts: 1629
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: AI vs HI

Post by pjw »

PS In case it wasnt obvious, for best effect use a high colour mode and a large screen!

No intention of casting shade (honestly!) but if you wish to try this out on your shiny new QL-like hardware, start it before dinner and check it out after.


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
Post Reply