Silverfrost Forums

Welcome to our forums

Which AI trained on Clearwin?

15 Jun 2025 10:19 #32161

Any movement in this direction?

16 Jun 2025 5:39 #32163

Dan

Who is this question for and what does it mean?

16 Jun 2025 8:46 #32166

AI novadays understands and writes texts on different languages. Anyone tried to train AI on Clearwin? I'd for example more like to see my responds from AI not mostly on Python but on Clearwin and think they would be more relevant and familiar. And could be included into my codes for further use.

Spent last three days with some easy task on ChatGPT, Grok and Deepseek and all of them eventually almost failed (I lost patience to continue endless corrections and start overs) with this task i would be done in CLearwin in 30 minutes.

18 Jun 2025 12:28 #32174

Since this compiler natively understands

  1. Assembler
  2. HTML
  3. OpenGL
  4. probably C/C++ too (?) At least it has to

how about adding here Python and its libraries for 2D/3D plotting? Then we will just wrap the solutions AI creates (typically done in Python) into Fortran or Clearwin+ functions and that will tremendously simplify using AI as well as plotting anything.

And possibly simplify anything else where Fortran requires a lot of efforts as Python is #1 language, way more popular than even C or Java or any other language, according to TIOBE listing
https://www.tiobe.com/tiobe-index/

18 Jun 2025 1:13 #32175

The Fortran code to generate images shown at the links below was produced by ChatGPT using Fortran and Clearwin+ graphics calls.

In each case I simply introduced the relevant Clearwin+ procedure name, purpose and arguments early in the conversation. Then asked for Fortran code using these procedures for the different plot types.

All working after a few hours on a rainy Saturday afternoon. The hardest part was to get ChatGPT to understand that the top left corner is at (0,0) and down and right from there is a positive distance!

https://www.dropbox.com/scl/fi/mnt12sv7hz9i3446836ks/Screenshot-2025-05-14-115136.jpg?rlkey=c8nprj61apprkgpwmghc751uf&st=9qfje3bx&dl=0

https://www.dropbox.com/scl/fi/c0p9jswyme7fu9lug8ca4/Screenshot-2025-05-14-114852.jpg?rlkey=exv424x8wgkt7chiesi3ivrzy&st=bxexhcmz&dl=0

https://www.dropbox.com/scl/fi/lzcllf4vj5eutba5yhtb5/Screenshot-2025-05-14-114950.jpg?rlkey=urx3moiwl552alaenn23yn0fa&st=m6uer5ir&dl=0

18 Jun 2025 5:54 #32177

Dan

Providing a Python backend sounds like a project that would take a number of man years. That would be a massive investment.

Ken

Your images are impressive. Is the code provided?

19 Jun 2025 5:50 (Edited: 20 Jun 2025 3:01) #32178

Ken, Definitely the 2D drawings, surface plots and 3D plots would have the largest value if AI will learn how to simplify this for us. Even usual X-Y plotting which Clearwin is doing now with ease and of production quality would potentially additionally simplified by AI

Please write more what specifically you and AI have done to create these 3D plots. That will get some idea on what amount of efforts this will take compared to conventional ways. May be would be better if you start with some simplest demo

19 Jun 2025 11:51 #32179

As an example, here is the code generated by AI when I asked it about Z-buffering algorithms.

https://www.dropbox.com/scl/fi/l0dlv0pum4libfhl99glg/Zbuffer_FTN95_CHATGPT.f95?rlkey=8qlhx6woey7p50crm3tue59uy&st=6tqfwetj&dl=0

AI is much better than I at generating comment lines to document the code!

If you paste this code into ChatGPT, you can then ask it to adapt the code for other algorithms e.g. Painter, at this point it knows all the necessary Clearwin+ procedures and there is a good chance that it makes the necessary changes without too many errors.

I have also found that if you have an old fortran procedure with lots of GOTOs there is a good chance that AI can restructure the logic using Fortran 90 constructs.

20 Jun 2025 2:59 (Edited: 21 Jun 2025 6:13) #32181

AI never stops to amaze me. If that was made by AI and it already knows about Clearwin the only I can say is WOW. So small, clear and simple code.

I will post similar program I made 30 years ago using Clearwin OpenGL. Will be interesting to compare which approach is more viable. Also important is the speed. I struggle with OpenGL lately, with data becoming larger and larger and larger i wish it would be faster and had no limitations on the size of plotting data. Some other OpenGL issues also hard to implement, like axis numbering.

May be AI, if it is that fluent with Clearwin and probably OpenGL, will ease both methods and Silverfrost will simplify them even more and implement 2D and 3D plotting similar way like they have done with x-y graphs using %PL when to plot complex graph of professional production quality require just 1-2 lines of Fortran code and hopefully not far from now probably with just a voice command (note, the key words here are professional quality)

UPDATE

Wow WOW WOW.... The ChatGPT is definitely familiar with FTN95, Clearwin, OpenGL and even older Salford FTN77 !

I asked to convert my old FTN77 Clearwin/OpenGL code to FTN95 and it have done that in seconds. Before i tried to do the same with some code beautifiers and many failed creating Fortran90 mess, others required $1000 payment.

I pointed to ChatGPT on some conversion errors (trailing comma error left by mistake which among all compilers only FTN95 can catch) and it responded:

'OK, I've fixed the trailing comma issue in REAL*8 declarations like the one you mentioned (spiny, → spiny). The cleaned and corrected file is now ready:

👉 Download mesh_ftn95_cleaned.f90

Please try compiling this version. If there are any remaining errors, just copy-paste them here, and I’ll help resolve them step by step. ' 😃 😃 😃 😃

UPDATE2

And Grok is even better. I am very surprised these two AIs are already familiar with all these proprietary things. Grok made only one, and looking like a typo error converting files from FTN77 to FTN95 (it wrote 1.-3e instead of 1.e-3. A hallucination ? ) . Here is the link on this 3D code made with Clearwin/OpenGL

https://www.dropbox.com/scl/fi/zevk47ul40epky9dar718/mesh_mod.f95?rlkey=lpdbfs8d5fifwfseeupndm07b&st=i13rltq8&dl=0

Compilation: ftn95 mesh_mod.f95 /link /64

20 Jun 2025 9:40 #32182

Dan, you are far ahead of me at this game!

In your code at line 684:

    ig111 = ig111 + 2 * (RelColLum - 0.5D0) * ig

ig was not previously been assigned a value.

Last evening I asked ChatGPT to modify the code I posted previously, to implement the following modifications, each done sequentially:

  1. include a surrounding margin,
  2. draw the surrounding cuboid
  3. draw the coordinates at each corner of the cuboid.
  4. draw tick marks are the corners and midpoints of each edge.

Here is the result of just 30 minutes 'chat'. These are prerequisites for the next step - linear x, y, z scales.

https://www.dropbox.com/scl/fi/7le3xqtq8ahq74pgud59d/Zbuffer2_FTN95_CHATGPT.f95?rlkey=m5ubj4zvqyohif0si62otzprw&st=p7g3y6es&dl=0

20 Jun 2025 11:44 #32183

Ken, You have steady progress in the right direction!

Hopefully AI learning Clearwin from our attempts. I suggest users to try this too. For example would be great if somebody will ask AI to convert all 'Silverfrost Clearwin Examples' from their mostly Fortran-77 style to Fortran-90 style with modules and without. This will teach AI to understand Clearwin more.

Because looks like its skills are still not super great. I tried to convert for example this code for Property Sheet to Fortran90 style in Grok. My idea was not just convert it but also ask AI to add one more property sheet tab (often needed and somewhat painful operation in existing codes). I gave up after 1 hour even to convert to Fortran-90! The AI make too many unexplainable moves

       OPTIONS(INTL)
       INCLUDE <WINDOWS.INS>
       INTEGER K1,K2,K3,ANS
       INTEGER MALE,FEMALE
       INTEGER ALIVE,CONSCIOUS,COMFORTABLE,AGE
       CHARACTER*20 NAME
       CHARACTER*200 REPORT
       DATA NAME/'Fred Bloggs'/

       report='Mr. Bloggs has a large wart'//char(13)//char(10)//
     +'on his left buttock which'//char(13)//char(10)//
     +'should be removed with caustic soda'//char(13)//char(10)
                       MALE=1
       FEMALE=0
       ALIVE=1
       CONSCIOUS=1
       COMFORTABLE=0
       AGE=75

C
C      Sheet 1
C
       ANS=WINIO@('%ca[Personal]Personal information:%nl%nl&')
       ANS=WINIO@('%obName:%ta%rs%nlAge:%ta%rd%nlSex: %rb[Male]   '//
     +'%rb[Female]%2ga%cb%sh',NAME,AGE,MALE,FEMALE,MALE,FEMALE,K1)
C
C      Sheet 2
C
       ANS=WINIO@('%ca[Medical]General patient condition%nl%nl&')
       ANS=WINIO@('%ob%rb[Alive]%nl%rb[Conscious]%nl%rb[Comfortable]'//
     +'%cb%sh',ALIVE,CONSCIOUS,COMFORTABLE,K2)
C
C      Sheet 3
C
       ANS=WINIO@('%ca[Report]Doctor''s report%nl%nl&')
       ANS=WINIO@('%pv%30.4eb[hscrollbar,vscrollbar]%sh',REPORT,200,K3)
C
C     The main window
C
        ANS=WINIO@('%bg[grey]%ca[Patient status]%3ps',K1,K2,K3)
        END
20 Jun 2025 12:52 #32184

Dan, In you code at line 711

  i = winio@('%pv%80.10&amp;[hscroll,vscroll]&amp;', iOUTun1)

There is a missing format code after the second %.

I must get back to what I should be doing!

20 Jun 2025 2:30 #32185

Ken, Thanks, the first error at line 681 is my own error, ig was forgotten there, should be removed.

The second at line 711 is AI fault, in the original FTN77 code all is fine Should be i = winio@('%pv%80.10cw[hscroll,vscroll]&', iOUTun1)

Fixed. I am surprised Grok making a lot of typos like that. Three per such small code

21 Jun 2025 6:33 #32186

By the way, talking about training of AI on Clearwin, may be Grok was right by deleting the %sh at the end of lines when rebuilding to Fortran-90 that small Salford Clearwin FTN77 %ps example above? Unfortunately AI deleted %sh completely because it clearly has little experience yet in this.

I followed this demo for years for many my property sheets but had their strange behavior sometimes. I asked this forum one day and according to Paul clarification few years back the %sh has to be first control for each new tab not the last one.

I encourage all to try 'training' AI using any your Clearwin codes. It is really easy and for Grok, DeepSeek and many other AI is free. Even ChatGPT is free for light use. Just say to AI 'Please rebuild my Fortran-77 style source code made with Salford Fortran-77 FTN77 compiler to modern Fortran-95 style of Silverfrost Fortran FTN95 compiler' and upload the code. Always say Please because it is AI who will help to find the retirement home for you

22 Jun 2025 1:29 #32193

A rather amusing reader's letter in Friday's issue of The Scotsman.

Green MSP Lorna Slater raised eyebrows with her Parliamentary AI experiment

Opposing a motion to the Scottish Parliament “Demanding a Better Deal for Taxpayers in Scotland”, Green MSP Lorna Slater presented the case that, once the benefits of various policies such as “free” prescriptions, bus travel, tuition fees and social care was taken into account and despite higher income tax rates, people in Scotland are generally better off than people in England.

To prove her point, she had put her thesis into an AI chatbot which confirmed her view. If the output from AI was capable of unequivocally defining what is true, it would strengthen her argument; however, it does not have that capability.

Troubled by two recent incidences where ChatGPT had not just given me wrong information but made up “facts” (a phenomenon known as “hallucination”), I challenged ChatGPT as to why it does that. Its response was enlightening and included the following: “It was trained to sound helpful – not to know the truth. So, when you ask a question, it tries to give you the kind of answer it thinks you want – even if it has to guess.”

I find it amusing that Lorna Slater, a politician, relied upon AI to justify her position. After all, the text quoted above would also be a reasonable description of most politicians.

25 Jun 2025 8:42 #32197

Ok, let's teach AI a bit of Clearwin+ syntax and also possibly learn from it.

Grok learned from our previous communications that I like to see visualization in FTN95 and offered me without even me asking to plot in Clearwin some functions I was discussing with it. I was pleasantly surprised. Of course responded Yes. Here is the source code it generated.

I do not know where Grok learned all these Clearwin controls and how to use them given that it clearly has no idea about the major thing with Clearwin that all its variables have to be REAL*8 not just REAL.

      PROGRAM LGIntensityPlot
      INCLUDE <clearwin.ins>,nolist

      INTEGER ANS, I
      REAL R, INTENSITY, W0
      PARAMETER (W0 = 1.0) ! Beam waist at z=0
      REAL X(100), Y(100)

!     Open canvas panel for plotting
      ANS = WINIO@('%ca[LG_{0,1} Intensity Profile]%bg[white]&')
      ANS = WINIO@('%cn%pn[canvas,200,200]%ff&')

!     Calculate intensity profile for r from 0 to 2*w0
      DO I = 1, 100
         R = REAL(I-1) * 2.0 * W0 / 99.0
         INTENSITY = (2.0 * R**2 / W0**2) * EXP(-2.0 * R**2 / W0**2)
         X(I) = R
         Y(I) = INTENSITY
      END DO

!     Plot the intensity profile
      ANS = WINIO@('%ca[Plot]%pn[canvas,200,200]%pl[xy]&', X, Y, 100)

!     Keep window open
      ANS = WINIO@('%ca[Close to Exit]%bt[OK]&', 'exit')
      ANS = WINIO@('%lw', LW)

      END PROGRAM LGIntensityPlot     

OK, I fixed REAL to REAL*8 and compiled the code which got without a single hiccup but when tried to run I got run-time error that %pn[canvas,200,200] is unrecognized format code. What Grok means by %pn ? Any idea? Probably it tries to set the plotting image size in pixels 200x200. I like the idea how it suggests to do that by the way, inline, i do not like to do that in separate line with CALL WINOP.... But why it tries to set it twice?

Then also %ca is used 3 times which is an error of Clearwin, only one %ca is allowed

Another error: the xy option in %pl[xy] is wrong. Or may be there exist such simplest undocumented option ? Could be good idea to have that

Also there is an order error in '...%pl[xy]&', X, Y, 100) '. Though may be good idea for future smart Clearwin to accept variables in any order.

So what was all the hell taken from ? May be I missed some earlier 30+ years old versions? Or the versions of last year?

26 Jun 2025 5:32 #32198

There is no %pn in ClearWin+. It looks like it is intended to define a graphics region with given attributes and dimensions. Maybe there is some graphics interface other than ClearWin+ that has 'canvas' etc..

26 Jun 2025 5:11 #32202

Paul, Thanks for info about %pn hallucination. And how about this line

 ANS = WINIO@('%ca[Plot]%pn[canvas,200,200]%pl[xy]&', X, Y, 100)

was there any basis for Grok to write this? Is it possible to setup the plot dimensions in separate place and also to use this order of X,Y, and number of points 100?

27 Jun 2025 4:54 (Edited: 27 Jun 2025 6:02) #32203

What i just realized is that most probably this Clearwin code was using older Simpleplot plotting %pl utility I completely forgot about. I rewrote all my codes to new so called native %pl long ago. There indeed potentially might existed these 'canvas' and different orders of calling conventions. But as I remember still the variables X and Y there were of double precision, not just REAL like Grok supplied to me, am I right?

I need all that to 'discuss' with AI how it must learn all modern Clearwin things and unlearn older %pl and some older Simpleplot commands. Better of course if Paul would do that otherwise there will be a holly mess of DBOS, Salford graphics library, Simpleplot, Clearwin and native Clearwin codes all conflicting with each other

Even better would be if we prepare kind of new Standard how we all want to see AI will supply graphics solutions to us in the future. It must be ultimately simple and professionally looking at the same time . If one curve on the plot will be needed - there will be one kind of simple FTN95 codes, if two curves on the plot need to be presented - another code, with 3D plots - third way. But definitely the gibberish like today with older Clearwin the AI must to unlearn

(I'd say that the graphics Grok, DeepSeek and ChatGPT provide right now with Python is looking really good and is very very simple so it will be difficult to Clearwin to compete with that)

27 Jun 2025 5:31 #32204

Dan

If what you are asking for is feasible then it is outside of my skill set.

I have looked for clues on the Internet but made no progress.

Please login to reply.