• Re: New prog: Game of Life

    From Sebastian Barthel@21:1/5 to All on Sat Sep 25 15:39:37 2021
    Am Sun, 19 Sep 2021 16:52:49 +0200 schrieb Paul Sprangers:

    Dear all,

    A RISC OS version of the famous "Game of Life" is ready for download at

    www.riscos.sprie.nl/Pages/GameLife.html

    The Game of Life is about 50 years old, and invented by the English mathematician John Conway. It lets cells (black squares on a white grid) evolve according to 3 simple rules. The result is often quite
    fascinating.


    Thank You for writing this. It's a fine new program for an old-fashioned problem. It runs here in RPCEmu on 5.15 without problems. But there are
    some minor "glithces" wich could be upgraded or polished out. On of the
    easier one is eventually the use of writable Texticons for the setting of
    the grid-size. This would speed up the setting and makes it more
    comfortable - literally at no costs. Another idea could be the automatic adaption of the gridsize if one loads a dataset with higher or lower
    numbers of cells.

    And there seems to be a little problem with the zoom (?). Here the
    program always shows the same number of fields on the screen - regardless
    wich gridsize is set.


    But at all it runs fine and does all the thing a Game of Live should do.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Sebastian Barthel on Sat Sep 25 18:25:12 2021
    In article <sinfrp$700$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:

    [...] the use of writable Texticons for the setting of the grid-siz

    Yes, that would be easy enough, although the bumpers prevent you from
    entering invalid numbers more safely. However, see below.

    And there seems to be a little problem with the zoom (?). Here the
    program always shows the same number of fields on the screen - regardless > wich gridsize is set.

    The number of fields, that currently have a fixed width of 45, only depends
    of the screen resolution. Choosing a larger grid only increases the
    invisible area (the porches, as I choosed to call them). However, this is
    what I'm now working on. The next update should automatically choose the optimal cell size, together with the optimal grid size, thus providing the largest possible visible grid in any screen mode, although you may still
    alter these figures manually, of course.

    But at all it runs fine and does all the thing a Game of Live should do

    Well, only after releasing my version, I was pointed to !MacroLife of Chris Taylor. It's 25 years old and 26-bit, but it runs under Aemulor and beats
    my program on virtually every aspect. The only reason that I'm still
    working on it is the sheer pleasure of amateur programming.

    Kind regards,
    Paul Sprangers

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Barthel@21:1/5 to All on Sun Sep 26 21:26:32 2021
    Am Sat, 25 Sep 2021 18:25:12 +0200 schrieb Paul Sprangers:

    In article <sinfrp$700$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:

    [...] the use of writable Texticons for the setting of the grid-siz

    Yes, that would be easy enough, although the bumpers prevent you from entering invalid numbers more safely. However, see below.

    And there seems to be a little problem with the zoom (?). Here the
    program always shows the same number of fields on the screen -
    regardless > wich gridsize is set.

    The number of fields, that currently have a fixed width of 45, only
    depends of the screen resolution. ...
    this is what I'm now working on. The next update should automatically
    choose the optimal cell size, together with the optimal grid size ...

    Should be an not too hard task of programming.

    Eventually its a good idea to draw only the fields wich are visible too.
    This should speed up the thing 'immensely'.


    But at all it runs fine and does all the thing a Game of Live should do

    Well, only after releasing my version, I was pointed to !MacroLife of
    Chris Taylor. It's 25 years old and 26-bit, but it runs under Aemulor
    and beats my program on virtually every aspect. The only reason that I'm still working on it is the sheer pleasure of amateur programming.

    That's true - !MacroLife is a cool program and is very speedy for its
    time.

    BUT: it is NOT new, it is NOT 32 Bit safe, it had NEVER seen an upgrade
    and it ALWAYS is a good thing if there are other solutions to one
    "problem".

    Here is a link to motivate You in that GoL is useful in some other ways -
    some people are using this to build up logic machines wich then can be programmed - for instance to create the program Game of Live written in
    Game of Live

    https://www.youtube.com/watch?v=6avJHaC3C2U&t=262s

    :)


    Its a fascinating idea this "GoL" and therefore a new variant to play
    with it is always good thing.



    All the best,
    SBn

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to All on Mon Sep 27 18:22:40 2021
    Dear all,

    Just a quick note that !GoL is now at version 1.06. Most important
    improvement is the flexibility of the grid (I hope).

    http://www.riscos.sprie.nl/sprang.riscos/Pages/GameLife.html

    Kind regards,
    Paul Sprangers

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Barthel@21:1/5 to All on Wed Sep 29 11:25:47 2021
    Am Mon, 27 Sep 2021 18:22:40 +0200 schrieb Paul Sprangers:

    Just a quick note that !GoL is now at version 1.06. Most important improvement is the flexibility of the grid (I hope).

    http://www.riscos.sprie.nl/sprang.riscos/Pages/GameLife.html

    OK. Works.

    The window is a little bit "displaced" sometimes, in a way that the top- window-bar is then outside the desktop. But thats on RPCEmu - eventually
    this effect doesn't show on real hardware.


    Eventually You could try to use the WIMP Windowupdate/redraw Events to
    update only the portion of the window wich has been modified too. This
    should speed up the things a bit more - especially if one moves the
    buttonbar (play,forward,reset,random etc) on top of / over the drawn
    playfield.


    It's a fine Game - and probably will be so all the times to come. Its
    like fractals or 3D plot curves - fascinating in its very own style.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Sebastian Barthel on Wed Sep 29 13:57:38 2021
    In article <sj1ifr$96t$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:

    Eventually You could try to use the WIMP Windowupdate/redraw Events to
    update only the portion of the window wich has been modified too. This
    should speed up the things a bit more - especially if one moves the
    buttonbar (play,forward,reset,random etc) on top of / over the drawn playfield.

    Yes, I have been looking at that for hours. When called from the poll loop,
    the window always gets redrawn completely, in contrast to the plotting of
    the individual cells per generation. The latter only plots the changes
    indeed. But I've no idea how to force the redraw loop to be as selective.

    Curious about a hint...
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to All on Wed Sep 29 14:00:25 2021
    https://www.youtube.com/watch?v=6avJHaC3C2U&t=262s

    By the way, this YouTube lecture is absolutely bloody amazing! Thanks for pointing me to it.

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin@21:1/5 to Paul Sprangers on Wed Sep 29 14:45:17 2021
    In article <59738a7fddPaul@sprie.nl>,
    Paul Sprangers <Paul@sprie.nl> wrote:
    In article <sj1ifr$96t$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:

    Eventually You could try to use the WIMP Windowupdate/redraw
    Events to update only the portion of the window wich has been
    modified too. This should speed up the things a bit more -
    especially if one moves the buttonbar (play,forward,reset,random
    etc) on top of / over the drawn playfield.

    Yes, I have been looking at that for hours. When called from the
    poll loop, the window always gets redrawn completely, in contrast
    to the plotting of the individual cells per generation. The latter
    only plots the changes indeed. But I've no idea how to force the
    redraw loop to be as selective.

    Curious about a hint...

    Have you looked at the Redraw Window poll request? Also SWIs
    Wimp_RedrawWindow and Wimp_GetRectangle - they give the rectangle to
    be redrawn. SWI Wimp_UpdateWindow can be used to start the process
    manually, if the Wimp does not.

    I notice that GoL uses Wimp_Poll all the time, even when it it just
    sitting on the iconbar doing nothing. It is currently processing
    anything up to 90,000 Null Polls/second doing nothing, using 30+% of
    the processor. This causes excessive power to be used and heat to be
    produced, resulting in fans being called into action more than they
    need. It would be better if Null Polls can be masked when not
    required, or WimpPoll_Idle used.

    Martin

    --
    Martin Avison
    Note that unfortunately this email address will become invalid
    without notice if (when) any spam is received.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Martin on Wed Sep 29 16:46:12 2021
    In article <5973945a9cNews03@avisoft.f9.co.uk>,
    Martin <News03@avisoft.f9.co.uk> wrote:

    Have you looked at the Redraw Window poll request? Also SWIs Wimp_RedrawWindow and Wimp_GetRectangle - they give the rectangle to
    be redrawn. SWI Wimp_UpdateWindow can be used to start the process
    manually, if the Wimp does not.

    I use Wimp_UpdateWindow for redrawing the changed cells individually, while leaving all others untouched. But I have no idea to do that within the RedrawWindow poll request. After all, after each new generation I know
    exactly which cells need to be redrawn, but how do I know that when another window floats over mine?

    I notice that GoL uses Wimp_Poll all the time, even when it it just
    sitting on the iconbar doing nothing. It is currently processing
    anything up to 90,000 Null Polls/second doing nothing, using 30+% of
    the processor.

    I didn't think of that, but making the poll mask dependent of auto running
    or not is easy enough. It will be fixed in the next update. By the way, how
    do you count those null polls?

    Thank you for helping me improve things.

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin@21:1/5 to Paul Sprangers on Wed Sep 29 16:53:20 2021
    In article <597399eea9Paul@sprie.nl>,
    Paul Sprangers <Paul@sprie.nl> wrote:
    In article <5973945a9cNews03@avisoft.f9.co.uk>,
    Martin <News03@avisoft.f9.co.uk> wrote:

    Have you looked at the Redraw Window poll request? Also SWIs Wimp_RedrawWindow and Wimp_GetRectangle - they give the rectangle
    to be redrawn. SWI Wimp_UpdateWindow can be used to start the
    process manually, if the Wimp does not.

    I use Wimp_UpdateWindow for redrawing the changed cells
    individually, while leaving all others untouched. But I have no
    idea to do that within the RedrawWindow poll request. After all,
    after each new generation I know exactly which cells need to be
    redrawn, but how do I know that when another window floats over
    mine?

    That is what the Redraw Window request is for from Wimp_Poll.

    I notice that GoL uses Wimp_Poll all the time, even when it it
    just sitting on the iconbar doing nothing. It is currently
    processing anything up to 90,000 Null Polls/second doing nothing,
    using 30+% of the processor.

    I didn't think of that, but making the poll mask dependent of auto
    running or not is easy enough. It will be fixed in the next update.
    By the way, how do you count those null polls?

    I use my TaskUsage, fom http://www.avisoft.f9.co.uk/

    Martin

    --
    Martin Avison
    Note that unfortunately this email address will become invalid
    without notice if (when) any spam is received.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From druck@21:1/5 to Paul Sprangers on Wed Sep 29 16:32:48 2021
    On 29/09/2021 15:46, Paul Sprangers wrote:
    By the way, how do you count those null polls?

    My !APPstat will count them. Also !CPULoad will show high usage with
    NULLs active. http://www.armclub.org.uk/free

    ---druck

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Barthel@21:1/5 to All on Wed Sep 29 16:56:31 2021
    Am Wed, 29 Sep 2021 14:00:25 +0200 schrieb Paul Sprangers:

    https://www.youtube.com/watch?v=6avJHaC3C2U&t=262s

    By the way, this YouTube lecture is absolutely bloody amazing! Thanks
    for pointing me to it.


    :)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Matthew Phillips@21:1/5 to All on Wed Sep 29 22:47:43 2021
    In message <597399eea9Paul@sprie.nl>
    on 29 Sep 2021 Paul Sprangers wrote:

    In article <5973945a9cNews03@avisoft.f9.co.uk>,
    Martin <News03@avisoft.f9.co.uk> wrote:

    Have you looked at the Redraw Window poll request? Also SWIs Wimp_RedrawWindow and Wimp_GetRectangle - they give the rectangle to
    be redrawn. SWI Wimp_UpdateWindow can be used to start the process manually, if the Wimp does not.

    I use Wimp_UpdateWindow for redrawing the changed cells individually, while leaving all others untouched. But I have no idea to do that within the RedrawWindow poll request. After all, after each new generation I know exactly which cells need to be redrawn, but how do I know that when another window floats over mine?

    The Wimp tells you which bits of the window need redrawing in the block
    pointed to by R1 in Wimp_GetRectangle. That gives you the x and y
    co-ordinates of the portion of the window which you need to redraw. The Wimp also sets the graphics window to match this area, so that if you plot
    anything outside that area it will not appear, thus avoiding other windows being obliterated.

    I imagine you have the cells in a two-dimensional array. You need to work
    out, from the screen or window co-ordinates provided by the Wimp, which cells overlap with that area, and then just redraw those, rather than looping
    through the whole of your array.

    It's extra effort, but it can really help to speed up the redraw.

    (Apologies if this is what you are doing already, but it sounded from your questions as though it wasn't.)

    If you don't mind using up the memory, anotehr approach is to create a sprite as big as your window work area, and redirect all your output to that sprite. Then you can simply plot the sprite in response to every window request. It appears that OS_SpriteOp knows about the graphics window and avoids doing any work on the bits that the Wimp has not asked for.

    --
    Matthew Phillips
    Durham

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Matthew Phillips on Thu Sep 30 17:01:32 2021
    In article <df85c07359.Matthew@sinenomine.co.uk>,
    Matthew Phillips <spam2011m@yahoo.co.uk> wrote:

    I imagine you have the cells in a two-dimensional array. You need to
    work out, from the screen or window co-ordinates provided by the Wimp,
    which cells overlap with that area, and then just redraw those, rather
    than looping through the whole of your array.

    Looping through the whole of my array was exactly what I was doing, and I couldn't see how to minimalise that process. However, with your explanation
    I finally managed to work out the x and y coordinates of the redraw block, returned by Wimp_GetRectangle, and calculate the corresponding cells from there. It's not completely perfect yet (dragging a window over the grid
    still leaves traces), but at least and at last it now happens
    instantaneously.

    In the past you helped me mastering the Wimp_UpdateWindow call, and now I
    feel that I'm close to understanding the RedrawWindow magic as well. I
    really can't be thankful enough.


    If you don't mind using up the memory, anotehr approach is to create a
    sprite as big as your window work area, and redirect all your output to
    that sprite. Then you can simply plot the sprite in response to every
    window request. It appears that OS_SpriteOp knows about the graphics
    window and avoids doing any work on the bits that the Wimp has not asked
    for.

    No doubt, but apart from having no idea how to redirect output to a sprite,
    I fear that plotting such large sprites would have a negative effect on the animation speed. Anyhow, since I'm more or less getting familiar with the Redraw- and UpdateWindow routines, I'm happy to stick with them.

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Matthew Phillips@21:1/5 to All on Thu Sep 30 19:42:26 2021
    In message <59741f2bd3Paul@sprie.nl>
    on 30 Sep 2021 Paul Sprangers wrote:

    In article <df85c07359.Matthew@sinenomine.co.uk>,
    Matthew Phillips <spam2011m@yahoo.co.uk> wrote:

    I imagine you have the cells in a two-dimensional array. You need to
    work out, from the screen or window co-ordinates provided by the Wimp, which cells overlap with that area, and then just redraw those, rather
    than looping through the whole of your array.

    Looping through the whole of my array was exactly what I was doing, and I couldn't see how to minimalise that process. However, with your explanation
    I finally managed to work out the x and y coordinates of the redraw block, returned by Wimp_GetRectangle, and calculate the corresponding cells from there. It's not completely perfect yet (dragging a window over the grid
    still leaves traces), but at least and at last it now happens instantaneously.

    Yes, it can be hard to get the rounding in the correct direction to include
    all the bits that do need redrawing.

    I'm glad to hear you have pretty much got it working. It's very satisfying getting redraw speeded up!

    --
    Matthew Phillips
    Durham

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to All on Sun Oct 3 13:25:06 2021
    Dear all,

    Version 1.07 of the Game of Life is now ready for download:

    http://www.riscos.sprie.nl/sprang.riscos/Downloads/GoL.zip

    IMPROVEMENTS
    - The poll mask now only allows null polls when animation is active.
    - The cell redraw is optimised
    - The window redraw is greatly optimised, albeit it still not perfect.
    - The control over grid dimensions is now more flexible.
    - The Options window can also be opened by clicking Adjust on the iconbar
    icon.
    - Some shapes come with comments that are shown in the Message window.

    STILL TO DO
    - Finding out why horizontal drags over the grid leave ugly traces
    (vertical drags don't).
    - Finding out if sprite plotting will be faster than font painting (I can't
    see why, but you never know).
    - Finding out if Chris Taylor is still around, the author of the far
    superior !MacroLife. (He doesn't reply to my e-mail...)

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to All on Tue Oct 5 15:27:01 2021
    Dear all,

    With the much appreciated help of Matthew Phillips, the redraw routine of
    !GoL is finally as it should be. Version 1.08 is out now.

    http://www.riscos.sprie.nl/sprang.riscos/Downloads/GoL.zip

    You will also find some modifications on the pane.

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Barthel@21:1/5 to All on Tue Oct 5 14:19:37 2021
    Am Sun, 03 Oct 2021 13:25:06 +0200 schrieb Paul Sprangers:

    Version 1.07 of the Game of Life is now ready for download:

    http://www.riscos.sprie.nl/sprang.riscos/Downloads/GoL.zip

    Great - to see it evolving.


    IMPROVEMENTS - The poll mask now only allows null polls when animation
    is active.

    I don't know if this is necessary - it should'n give much speed
    improvements. It does if one never uses a null event, but its absolutely
    OK to use it for calculating such stuff like in this program.

    But: Probably its not allowed to switch the (poll)mask% from within a
    running programm. I've never seen this and as far as I know it is, at
    least, "unusual". Normally a program says at the begin wich polls it
    wants and then uses only these - but it won't switch them on/off while it
    is active.


    - The cell redraw is optimised - The window redraw is greatly optimised, albeit it still not perfect.

    I see, You have done it in a "real RISCOS" way. Many people don't
    understand whats done there, and thats the WIMP only redraws a portion of
    the screen or the window and the actual drawing of this portion is done
    by the program.

    There are some speedupdates "available" wich You should include.

    First of all You are deleting the part of the window wich the WIMP tells
    You to "Redraw" by Yourself. Therefore You plot a color-inverted Symbol
    in/at the request place(s). Thats absolutely OK, and one can do so - it
    works; more or less. BUT: The WIMP not only tells You with Wimp_Redraw / Wimp_GetRectangle the positions on the screen that have to be updated - it
    also "clears" these areas for You.

    Its much faster to NOT use the PROC_paint , wich not only draws a symbol
    with inverted colours to every "clear" (FALSE) positon but wich also
    tests everyone of them, uses an time consuming procedure call and tries
    to set a Font Color and the Font itself for EVERY (!) plotted element.

    Eventually You could have a look at this :


    DEF PROCredraw(wh%)
    SYS "Font_SetFont",cell%
    !block% = wh%
    SYS "Wimp_GetWindowState",,block%
    ox% = block%!4 - block%!20
    oy% = block%!16 - block%!24
    SYS "Wimp_RedrawWindow",,block% TO more%
    xstart% = (block%!28 - ox%) DIV cellsize% +porch%
    xend% = (block%!36 - ox%) DIV cellsize% +porch%
    ystart% = (oy% - block%!40) DIV cellsize% +porch%
    yend% = (oy% - block%!32) DIV cellsize% +porch% + 1
    cellx% = xstart% : celly% = ystart%

    REM de-REM to show the not perfectly plotted rectangles
    REM SYS "Wimp_SetColour",10
    REM RECTANGLE FILL block%!28,block%!32,block%!36-block%!28,block%!40-block
    %!32

    IF round% THEN
    chr$ = "l"
    ELSE
    chr$ = "n"
    ENDIF
    SYS "Wimp_SetFontColours",,0,5
    SYS "Font_FindFont",,"Selwyn",fontsize*15,fontsize*15 TO cell%
    SYS "Font_SetFont",cell%

    WHILE more%

    REM REPEAT
    REM PROCpaint(celly%,cellx%)
    REM IF cellx% < xend% THEN
    REM cellx%+=1
    REM ELSE
    REM cellx% = xstart%
    REM IF celly% < yend% THEN celly%+=1
    REM ENDIF
    REM UNTIL celly% = yend% AND cellx% = xend%

    celly% = ystart%
    WHILE celly% <= yend%

    cellx% = xstart%
    WHILE cellx% <= xend%

    IF grid%(celly%,cellx%)=TRUE THEN SYS "Font_Paint",cell%,chr$,16, ox %+(cellx%-porch%)*cellsize%, oy%-(celly%-porch%+1)*cellsize%

    cellx%+=1
    ENDWHILE

    celly%+=1
    ENDWHILE

    SYS "Wimp_GetRectangle",,block% TO more%

    ENDWHILE

    ENDPROC




    Here the Wimp Redraw sets the fonts once beforehand, the colors and
    variables too and runs only one short plot-loop (WHILE) to plot the
    symbols. It never tries to delete anything - 'cause the WIMP did this
    already before it give to !block back to You.


    Give it a try !

    It's not perfect. There are some glitches too if one moves the toplevel
    window not straight in X or Y but it should be possible to find a fix.



    And, eventually, You want to have a deeper look into the magic of Font
    Handles. These are there to set them "permanently". So one can find a
    font and give it a name - a handle. After this one can always use this
    handle to set the actual font. Since the Redraw loop eliminated the
    "delete" font plotting its no problem here, but You use this at other
    lines too. And, there You only uses the handle "cell%" for every font,
    wich, everytime, You find directly beforhand at the same lines or nearby.
    BUT: You can find the to Fonts You are using once at the start of the
    program - and give them separate names / handles%. E.g. font15% and
    font16% - and then use only these handles in the program.


    And, to be in line with the WIMP redrawing it is, eventually, a good idea
    NOT to plot a font if You want to delete a position on the screen. You
    also could try to calculate the position of the bounding-box and then plot
    a filled rectangled on the screen, colored to background color.

    DEF PROCpaint(y%,x%)
    IF grid%(y%,x%) = FALSE THEN
    REM SYS "Wimp_SetFontColours",,5,0
    REM SYS "Font_FindFont",,"Selwyn",fontsize*16,fontsize*16 TO cell%
    REM CHR$ = "n"
    SYS "Wimp_SetColour",1
    RECTANGLE FILL ox%+(x%-porch%)*cellsize%, oy%-(y%-porch%+1)*cellsize%, cellsize%, cellsize%
    ELSE
    SYS "Wimp_SetFontColours",,0,5
    IF round% THEN
    SYS "Font_FindFont",,"Selwyn",fontsize*15,fontsize*15 TO cell%
    chr$ = "l"
    ELSE
    chr$ = "n"
    ENDIF
    SYS "Font_Paint",,chr$,16,ox%+(x%-porch%)*cellsize%,oy%-(y%-porch% +1)*cellsize%
    ENDIF

    This, together with the thing I wrote on fonts and their handles, allows
    You to reduce this code to a minimum, since there is no need for changing
    and finding fonts and no one needs change the colors - since Wimp/Graphic
    and Font colors are set seperately.

    The setting of chr$ too is minimisable - since its only used for ploting,
    not for deleting. So it can be eliminated from the PROCpaint completely -
    I didn't done this here.



    - The control over grid dimensions is now more flexible.
    - The Options window can also be opened by clicking Adjust on the
    iconbar icon.
    - Some shapes come with comments that are shown in the Message window.

    Every new feature is a godd feature.

    One thing in the User Experience can be a point to overthink: The square
    button on the userpanel is in its "old" logic a STOP symbol (tapes, CDs).
    But Your button here is a reset scwitch. Some people may find it
    misleading if they want to stop their "run" by pressing stop - ... and everything vanishes into the dungeon of doom.


    STILL TO DO - Finding out why horizontal drags over the grid leave ugly traces (vertical drags don't).
    - Finding out if sprite plotting will be faster than font painting (I
    can't see why, but you never know).
    - Finding out if Chris Taylor is still around, the author of the far
    superior !MacroLife. (He doesn't reply to my e-mail...)


    Eventually You could search for him by asking at ROOL. I think there will
    be people around who know something more and can tell how to reach for
    him.



    All the Best,
    Sebastian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin@21:1/5 to Sebastian Barthel on Tue Oct 5 15:44:04 2021
    In article <sjhmtp$evl$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:
    Am Sun, 03 Oct 2021 13:25:06 +0200 schrieb Paul Sprangers:

    IMPROVEMENTS - The poll mask now only allows null polls when
    animation is active.

    I don't know if this is necessary - it should'n give much speed
    improvements. It does if one never uses a null event, but its
    absolutely OK to use it for calculating such stuff like in this
    program.

    But: Probably its not allowed to switch the (poll)mask% from within
    a running programm. I've never seen this and as far as I know it
    is, at least, "unusual". Normally a program says at the begin wich
    polls it wants and then uses only these - but it won't switch them
    on/off while it is active.

    Changing the poll mask is perfectly normal. The key thing is to have
    Nulls disabled when the program does not require them - eg when it is
    doing nothing, sitting idly on the iconbar waiting for something to
    do.

    You can also switch to using PollIdle, and change the delay times,
    when a program is running.

    --
    Martin Avison
    Note that unfortunately this email address will become invalid
    without notice if (when) any spam is received.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Barthel@21:1/5 to All on Tue Oct 5 17:39:40 2021
    Am Tue, 05 Oct 2021 15:44:04 +0100 schrieb Martin:

    In article <sjhmtp$evl$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:
    Am Sun, 03 Oct 2021 13:25:06 +0200 schrieb Paul Sprangers:

    IMPROVEMENTS - The poll mask now only allows null polls when
    animation is active.

    I don't know if this is necessary - it should'n give much speed
    improvements. It does if one never uses a null event, but its
    absolutely OK to use it for calculating such stuff like in this
    program.

    But: Probably its not allowed to switch the (poll)mask% from within a
    running programm. I've never seen this and as far as I know it is, at
    least, "unusual". Normally a program says at the begin wich polls it
    wants and then uses only these - but it won't switch them on/off while
    it is active.

    Changing the poll mask is perfectly normal. The key thing is to have
    Nulls disabled when the program does not require them - eg when it is
    doing nothing, sitting idly on the iconbar waiting for something to do.

    You can also switch to using PollIdle, and change the delay times, when
    a program is running.


    OK. That's interesting !

    Then one can change almost all other poll events simply by disabling the
    mask entry. E.g. to temporarily switch off reaction to keypresses or
    messages.

    I only knew, that it is essential to outmask the nullevent, if the
    program don't use it, and most simple programs don't need it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin@21:1/5 to Sebastian Barthel on Tue Oct 5 19:31:16 2021
    In article <sji2ks$fsg$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:
    Am Tue, 05 Oct 2021 15:44:04 +0100 schrieb Martin:

    In article <sjhmtp$evl$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:
    Am Sun, 03 Oct 2021 13:25:06 +0200 schrieb Paul Sprangers:

    IMPROVEMENTS - The poll mask now only allows null polls when
    animation is active.

    I don't know if this is necessary - it should'n give much speed
    improvements. It does if one never uses a null event, but its
    absolutely OK to use it for calculating such stuff like in this
    program.

    But: Probably its not allowed to switch the (poll)mask% from
    within a running programm. I've never seen this and as far as I
    know it is, at least, "unusual". Normally a program says at the
    begin wich polls it wants and then uses only these - but it
    won't switch them on/off while it is active.

    Changing the poll mask is perfectly normal. The key thing is to
    have Nulls disabled when the program does not require them - eg
    when it is doing nothing, sitting idly on the iconbar waiting for
    something to do.

    You can also switch to using PollIdle, and change the delay
    times, when a program is running.

    OK. That's interesting !

    Then one can change almost all other poll events simply by
    disabling the mask entry. E.g. to temporarily switch off reaction
    to keypresses or messages.

    Yes ... but beware that the keypresses, messages or whatever will not
    be repeated, so they will be totally ignored. Null Polls will happen
    again at some time...

    --
    Martin Avison
    Note that unfortunately this email address will become invalid
    without notice if (when) any spam is received.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Sebastian Barthel on Wed Oct 6 10:51:16 2021
    In article <sjhmtp$evl$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:

    But: Probably its not allowed to switch the (poll)mask% from within a
    running programm. I've never seen this and as far as I know it is, at
    least, "unusual".

    I never did this before, but it just appears to work. Martin Avison has convinced us that it certainly isn't as unusual as we thought.


    Eventually You could have a look at this :
    DEF PROCredraw(wh%)
    SYS "Font_SetFont",cell%
    [... etc...]

    The idea of making use of rectangle fills rather than font painting is very valuable. Actually, it was my intention to eventually abandon the font
    approach and draw lines and fill rectangles instead. As a try-out I copied
    your redraw routine, together with the modified font-paint routine to the source, and it worked indeed, more or less. The main thing is that your routines do not create a grid. Only when evolution is running, the grid is drawn cell by cell again. So, something is missing apparently.
    More importantly however is that I don't notice any speed improvement. But
    that may be a matter of optimisation.


    It's not perfect. There are some glitches too if one moves the toplevel window not straight in X or Y but it should be possible to find a fix.

    That fix is provided by Matthew Phillips. In the old routine, the start-
    and end-addresses were defined outside the WHILE more% loop. After having
    them moved to the inside, the redraw was finally perfect.


    BUT: You can find the to Fonts You are using once at the start of the
    program - and give them separate names / handles%. E.g. font15% and
    font16% - and then use only these handles in the program.

    That's a clever solution that I will certainly include in the next update.


    One thing in the User Experience can be a point to overthink: The square button on the userpanel is in its "old" logic a STOP symbol (tapes, CDs).
    But Your button here is a reset scwitch. Some people may find it
    misleading if they want to stop their "run" by pressing stop - ... and everything vanishes into the dungeon of doom.

    Again, it was Matthew Phillips who drew my attention to this as well. You
    will find a more intuitive pane in the latest update.

    I really appreciate your comments and hints to improvement, and they set me thinking about the inner magics of the Wimp more than I ever did before.

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Barthel@21:1/5 to All on Thu Oct 7 20:47:11 2021
    Am Wed, 06 Oct 2021 10:51:16 +0200 schrieb Paul Sprangers:

    In article <sjhmtp$evl$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:

    Eventually You could have a look at this :
    DEF PROCredraw(wh%)
    SYS "Font_SetFont",cell%
    [... etc...]

    The idea of making use of rectangle fills rather than font painting is
    very valuable. Actually, it was my intention to eventually abandon the
    font approach and draw lines and fill rectangles instead. As a try-out I copied your redraw routine, together with the modified font-paint
    routine to the source, and it worked indeed, more or less. The main
    thing is that your routines do not create a grid. Only when evolution is running, the grid is drawn cell by cell again. So, something is missing apparently.
    More importantly however is that I don't notice any speed improvement.
    But that may be a matter of optimisation.

    The original routine doesn't do a grid, too. The plot one can see is only
    "by accident". Must have to do something with the colour of the
    background and the colours of the font (I would say so).

    If You want to plot a real(!) grid You can do so by including two LINE
    commands in the redraw loop. Since You know the exact position of the
    symbol wich should be plotted its easy to find e.g. the left-bottom to left-upper and the left-bottom to right-bottom coordinates. Since LINE
    are defined by width and height You only need to know them only once for
    every LINE, and since Your plot-boxes are quadrate squares width and
    height are the same.



    DEF PROCredraw(wh%)

    SYS "Font_SetFont",cell%
    !block% = wh%
    SYS "Wimp_GetWindowState",,block%
    ox% = block%!4 - block%!20
    oy% = block%!16 - block%!24
    SYS "Wimp_RedrawWindow",,block% TO more%

    IF round% THEN
    chr$ = "l"
    ELSE
    chr$ = "n"
    ENDIF

    SYS "Wimp_SetFontColours",,0,5

    SYS "Font_FindFont",,"Selwyn",fontsize*15,fontsize*15 TO cell%

    SYS "Font_SetFont",cell%

    WHILE more%
    xstart% = (block%!28 - ox%) DIV cellsize% +porch%
    xend% = (block%!36 - ox%) DIV cellsize% +porch%
    ystart% = (oy% - block%!40) DIV cellsize% +porch%
    yend% = (oy% - block%!32) DIV cellsize% +porch% +1
    cellx% = xstart% : celly% = ystart%

    SYS "Wimp_SetColour",14

    celly% = ystart%
    WHILE celly% <= yend%

    cellx% = xstart%
    WHILE cellx% <= xend%

    REM IF grid%(celly%,cellx%)=TRUE THEN SYS "Font_Paint",cell%,chr
    $,16, ox%+(cellx%-porch%)*cellsize%, oy%-(celly%-porch%+1)*cellsize%

    xpos%=ox%+(cellx%-porch%)*cellsize%
    ypos%=oy%-(celly%-porch%+1)*cellsize%

    IF grid%(celly%,cellx%)=TRUE THEN SYS "Font_Paint",cell%,chr$,16,
    xpos%, ypos%

    LINE xpos%,ypos%,xpos%,ypos%+cellsize%
    LINE xpos%,ypos%,xpos%+cellsize%,ypos%

    cellx%+=1
    ENDWHILE

    celly%+=1
    ENDWHILE

    SYS "Wimp_GetRectangle",,block% TO more%
    ENDWHILE
    ENDPROC



    This then plots a real(!) grid. But only at redraws.

    To plot it at the start a similiar code needs to be included in the right place. One of the things the WIMP gives to the humble programmer is the
    "easy update a window" variant. Therefore one uses the
    "Wimp_UpdateWindow" call - wich is espacially useful if one already has a functional redraw routine. Its then only a copy of the redraw procedure -
    only the Redraw call changes to UpdateWindow. And: one has to keep in
    mind that UpdateWindow operates with WorkArea coordinates (these are
    negative and counted from top) whereas Redraw uses "normal" coordinates.
    The PRMs have a good chapter with good drawings about this. And, in
    addition, the clearing of the rectangles has to be done by the programmer.

    To get it running as a hack You could also include the two LNIE commands
    in the paint procedure for the first time.

    If this runs as intended one has then a new option wich potetnially
    pleases some users - Grid on/off is then possible.


    Otherwise: if Your variant (wich shows a grid, but doesn't "paint" such a
    thing intentionally) is working reliably and on every platform its
    eventually faster than drawing hundreds of separate lines.
    So its then a "trick" - and not a bad one.



    It's not perfect. There are some glitches too if one moves the toplevel
    window not straight in X or Y but it should be possible to find a fix.

    That fix is provided by Matthew Phillips. In the old routine, the start-
    and end-addresses were defined outside the WHILE more% loop. After
    having them moved to the inside, the redraw was finally perfect.

    Yes. That makes sense, absolutely. It (the WIMP) always updates the new rectangle for redraw - but the program know only about the next
    coordinates if it asks and updates them - in the inner loop; otherwise one
    will only plot the firstmost area again and again.



    One thing in the User Experience can be a point to overthink: The
    square button on the userpanel is in its "old" logic a STOP symbol
    (tapes, CDs).
    But Your button here is a reset scwitch. Some people may find it
    misleading ...

    Again, it was Matthew Phillips who drew my attention to this as well.
    You will find a more intuitive pane in the latest update.

    've seen it in v108. The new pane has the square button, but the
    arrangement of the buttons on the left side is much better than before,
    since it now follows a logic order.



    I really appreciate your comments and hints to improvement, and they set
    me thinking about the inner magics of the Wimp more than I ever did
    before.

    Thats fine.

    And I, too, learn some things or refresh long forgotten "structures", if
    I write such comments. WIMP is a "riddle" and "mystery" and sometimes it
    is very frustrating. But then, if it runs and does the things as
    intended, its a very cool and clean and speedy desktop interface.


    All the best,
    SBn

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Sebastian Barthel on Fri Oct 8 12:28:09 2021
    In article <sjnmcf$icq$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:

    The original routine doesn't do a grid, too. The plot one can see is only
    "by accident". Must have to do something with the colour of the
    background and the colours of the font (I would say so).

    That's exactly so. But I wouldn't call it 'by accident', it's very much intentional: the grid is drawn by white Selwyn squares, while the 'lines'
    are actually nothing else than the window background peeking through those squares.

    Since most squares need to be drawn and redrawn sooner or later anyhow -
    and often with hundreds or even thousands simultaneously - I assumed that
    this would be a faster approach than drawing real lines all the time as
    well, something that your alternative seems to confirm. It's not noticeably slower, but it definitively isn't faster.

    (As an aside: I write and test this program on a 4té, which is so
    incredibly fast that sometimes the speed of the subsequent generations
    exceeds the screen refresh, resulting in seemingly stuttering oscillations,
    to be compared with car wheels spinning backwards in movies.)


    The new pane has the square button, but the arrangement of the buttons
    on the left side is much better than before, since it now follows a
    logic order.

    ... and the Fast Forward button now turns into the Pause symbol when
    running, which should distract people from clicking the white square button when they want to interrupt the process. On the other hand, if someone
    knows a better symbol for clearing the grid, I would love to hear it.

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Paul Sprangers on Fri Oct 8 12:44:19 2021
    In article <597824d483Paul@sprie.nl>,
    Paul Sprangers <Paul@sprie.nl> wrote:

    On the other hand, if someone
    knows a better symbol for clearing the grid, I would love to hear it.

    To answer my own question, I've drawn a small grid in the Clear grid
    button. I think it is more clear now.

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Matthew Phillips@21:1/5 to All on Sat Oct 9 08:22:58 2021
    In message <5976c58cd9News03@avisoft.f9.co.uk>
    on 5 Oct 2021 Martin wrote:

    In article <sji2ks$fsg$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:
    Am Tue, 05 Oct 2021 15:44:04 +0100 schrieb Martin:

    Changing the poll mask is perfectly normal. The key thing is to have Nulls disabled when the program does not require them - eg when it is doing nothing, sitting idly on the iconbar waiting for something to do.

    You can also switch to using PollIdle, and change the delay
    times, when a program is running.

    OK. That's interesting !

    Then one can change almost all other poll events simply by
    disabling the mask entry. E.g. to temporarily switch off reaction
    to keypresses or messages.

    Yes ... but beware that the keypresses, messages or whatever will not
    be repeated, so they will be totally ignored. Null Polls will happen
    again at some time...

    I'm not sure that's quite right. The description of the mask on page 3-117 of the printed RISC OS 3 PRMs distinguishes between some events which are completely masked out (e.g pointer leaving/entering window, lose/gain caret) and others which will merely be queued, these being window redraw, mouse
    click, and key press.

    Mind you, I have never experimented with this, however, and there is a note underneath that says "the bits which are marked 'queue for later handling'
    stop the Wimp from proceeding, i.e. it stops all other tasks too".

    In most software you decide which events you're never going to need (e.g.
    poll word non-zero, pointer leaving window) and mask them out. The most important thing is to mask out null events when you don't need them.
    Receiving all the possible null events should only be done if you are doing something intensive and want to remain responsive with multitasking. It is also important to poll the Wimp frequently enough during this. I mainly use Wimp_PollIdle if there is a regular activity to do, like updating a clock, or every 25cs while dragging is occurring, so as to support the Drag and Drop protocol, autoscrolling of windows, etc.

    --
    Matthew Phillips
    Durham

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin@21:1/5 to Matthew Phillips on Sat Oct 9 09:56:28 2021
    In article <34b6977859.Matthew@sinenomine.co.uk>,
    Matthew Phillips <spam2011m@yahoo.co.uk> wrote:
    In message <5976c58cd9News03@avisoft.f9.co.uk>
    on 5 Oct 2021 Martin wrote:

    In article <sji2ks$fsg$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:
    Am Tue, 05 Oct 2021 15:44:04 +0100 schrieb Martin:

    Changing the poll mask is perfectly normal. The key thing is
    to have Nulls disabled when the program does not require them
    - eg when it is doing nothing, sitting idly on the iconbar
    waiting for something to do.

    You can also switch to using PollIdle, and change the delay
    times, when a program is running.

    OK. That's interesting !

    Then one can change almost all other poll events simply by
    disabling the mask entry. E.g. to temporarily switch off
    reaction to keypresses or messages.

    Yes ... but beware that the keypresses, messages or whatever will
    not be repeated, so they will be totally ignored. Null Polls will
    happen again at some time...

    I'm not sure that's quite right. The description of the mask on
    page 3-117 of the printed RISC OS 3 PRMs distinguishes between some
    events which are completely masked out (e.g pointer
    leaving/entering window, lose/gain caret) and others which will
    merely be queued, these being window redraw, mouse click, and key
    press.

    Yes, I am aware of that, but I decided to try and keep the explanation
    as simple as I could.

    Mind you, I have never experimented with this, however, and there
    is a note underneath that says "the bits which are marked 'queue
    for later handling' stop the Wimp from proceeding, i.e. it stops
    all other tasks too".

    Me too - I have never tried it, and am puzzled by the note.

    In most software you decide which events you're never going to need
    (e.g. poll word non-zero, pointer leaving window) and mask them
    out. The most important thing is to mask out null events when you
    don't need them. Receiving all the possible null events should
    only be done if you are doing something intensive and want to
    remain responsive with multitasking. It is also important to poll
    the Wimp frequently enough during this. I mainly use Wimp_PollIdle
    if there is a regular activity to do, like updating a clock, or
    every 25cs while dragging is occurring, so as to support the Drag
    and Drop protocol, autoscrolling of windows, etc.

    Agree totally - it is the main reason I wrote TaskUsage ablot 25 years
    ago (gosh!), and why I try to let authors know if I think Nulls are
    being used for no good reason.

    --
    Martin Avison
    Note that unfortunately this email address will become invalid
    without notice if (when) any spam is received.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rosemary Miskin@21:1/5 to All on Sat Oct 9 03:28:12 2021
    This thread takes me back a bit (? a lot)

    In the late 1960s I knew John Conway in Cambridge, and we played his new
    game using counters on sheets of squared paper.

    He would be amazed and delighted that it is still being played 50 years later, in a more modern form.

    Rosemary

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Barthel@21:1/5 to All on Mon Oct 11 19:24:12 2021
    Am Sat, 09 Oct 2021 03:28:12 -0700 schrieb Rosemary Miskin:

    This thread takes me back a bit (? a lot)

    In the late 1960s I knew John Conway in Cambridge, and we played his new
    game using counters on sheets of squared paper.

    He would be amazed and delighted that it is still being played 50 years later,
    in a more modern form.

    Rosemary


    Thats a very interesting comment.

    And I suppose that this will be one of the games or better programs or "algorithms" that have been made "for ever". Its a true classic in the
    same sense as "Tower of Hanoi" or "Barnsley's fern" or "Koch snowflake"
    are - great and impressive ideas, with the special feature that all of
    them are execeptionally great examples for the connection between pure mathematics and graphics and computers. They will be found - together
    with the Game of Life - in books for programmers for the rest of all
    times. And thats a great thing. Absolutely amazing, as some would tend to
    say.


    And thats why its good if RISCOS gets a new version too; from time to
    time. And this should be as usable as possible (there are some minor
    "glitches" in its current state), but actual its already usable and one
    can get a good impression of the power of these 4 little rules that are
    behind all the fancy gliders and sliders and oscillators.


    SBn

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Sebastian Barthel on Tue Oct 12 12:26:50 2021
    In article <sk230s$37q$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:

    In the late 1960s I knew John Conway in Cambridge, and we played his
    new game using counters on sheets of squared paper.

    Thats a very interesting comment.

    I wholeheartedly agree. At the ROOL forum, some contributors memorised
    their contact with John Conway as well, thus making the past nearly
    tangible.


    And thats why its good if RISCOS gets a new version too; from time to
    time. And this should be as usable as possible (there are some minor "glitches" in its current state), but actual its already usable and one
    can get a good impression of the power of these 4 little rules that are behind all the fancy gliders and sliders and oscillators.

    I may have addressed some of the glitches.
    Version 10 offers the possibility to switch off the grid, and has a much
    more flexible grid control. Altering the grid dimensions will just do that, while altering the cell dimension will always try to find corresponding
    rows and columns in such way that the entire desktop is filled, minus the iconbar.

    Download from:

    http://www.riscos.sprie.nl/sprang.riscos/Downloads/GoL.zip

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to All on Sat Oct 16 17:54:25 2021
    Dear all,

    I can't stop modifying my program.
    The most important improvement is that I introduced memory blocks, instead
    of two-dimensional arrays. My experience is that memory blocks benefit
    greatly from getting compiled, while they need considerably less memory
    than arrays. As an example: the 857 generations of the Kite>Manta shape in
    a 400x400 grid take 14 minutes and 7 seconds in Basic on my 4té. The same process in the compiled version takes 21 seconds - a 40 times speed gain!

    Improvements:
    - Much faster.
    - Largest grid is now 400 x 400.
    - Shapes may be moved around the grid using the cursor keys, with or
    without Shift held down.
    - Cell shape toggle and Grid toggle, by Adjust clicking on the pane, are swapped. The new location is more intuitive, I think.
    - The Random button reflects the cell shape.

    http://www.riscos.sprie.nl/sprang.riscos/Downloads/GoL.zip

    Best wishes,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Barthel@21:1/5 to All on Tue Oct 19 11:44:41 2021
    Am Sat, 16 Oct 2021 17:54:25 +0200 schrieb Paul Sprangers:

    I can't stop modifying my program.

    That's normal ... :) and very good. Especially since the latest iteration
    gave an IMPRESSIVE speedboost, and some minor but very handsome
    iconchanges.


    The most important improvement is that I introduced memory blocks,
    instead of two-dimensional arrays. My experience is that memory blocks benefit greatly from getting compiled ... - a 40
    times speed gain!

    And that's not the maximum that could be reachable. There are some more
    speed uprgrade possible, if You try to change the check procedure. At the
    cost of readability of the code.


    Improvements:
    - Much faster.

    Thats true. Runs in good animation speed on my RPCEmu with a smaller grid
    of e.g. 128x96

    - Largest grid is now 400 x 400.

    Thats the max. But probably not the best idea to use it as the default
    mode. At the start of the program - for a new users first time run - its absolutely necessary that he can click and play around easily with the "elements". On my screen I would say a 96x64 resolution of the grid is a
    good starting point. On higher screenresolutions on a RPi or coming
    machines something around 128x96 or 160x128 could be a good starting
    point.

    An experienced user of this program will set his/her own resolution. But
    to get involved into the program 400x400 isn't ideal.


    - Shapes may be moved around the grid using the cursor keys, with or
    without Shift held down.

    Need to try this. Sounds interesting.


    - Cell shape toggle and Grid toggle, by Adjust clicking on the pane, are swapped. The new location is more intuitive, I think.

    That IS more intuitive !

    Eventually there also could be a second icon for the grid button, too.
    One with broken/interrupted lines in it ( - - - - - ) ( - - - - ).
    Or a little painted checkmark in the lower corner of the gridsymbol.


    - The Random button reflects the cell shape.

    Very handy.


    http://www.riscos.sprie.nl/sprang.riscos/Downloads/GoL.zip

    Thanks for bringing this to the massive audience :)

    Eventually You could also announce the next version (or this one here) in
    the comp.sys.acorn.announce and ROOL - its a major step forward.


    All the best,
    SBn

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Sebastian Barthel on Wed Oct 20 17:11:37 2021
    In article <skmb39$bsm$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:

    There are some more speed uprgrade possible, if You try to change the
    check procedure. At the cost of readability of the code.

    I really wouldn't know how to speed up that routine, short and simple as it already is. What I *am* thinking about, is to assign a single bit to each
    cell, rather than a byte. This might speed up things, only if it wouldn't
    cost extra time to calculate the individual bits involved. But even when it would slow down the program marginally, it would definitively need 8 times
    less memory. However, I first have to think about a short and effective
    routine that sets and reads single bits.

    At the start of the program - for a new users first time run - its
    absolutely necessary that he can click and play around easily with the "elements". On my screen I would say a 96x64 resolution of the grid is a
    good starting point.

    Good point. I'll think about a useful beginners grid and add that as the
    first time default.

    Eventually there also could be a second icon for the grid button, too.
    One with broken/interrupted lines in it ( - - - - - ) ( - - - - ).
    Or a little painted checkmark in the lower corner of the gridsymbol.

    Good point too. I'll think about it.

    Thanks for bringing this to the massive audience :)

    Ha-ha!

    Eventually You could also announce the next version (or this one here)
    in the comp.sys.acorn.announce and ROOL - its a major step forward.

    Don't you think that people who read the comp.sys.announce will also read
    this group?

    Thanks for the feed back, very much appreciated!

    Best wishes,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Barthel@21:1/5 to All on Fri Oct 22 11:24:48 2021
    Am Wed, 20 Oct 2021 17:11:37 +0200 schrieb Paul Sprangers:

    In article <skmb39$bsm$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:

    There are some more speed uprgrade possible, if You try to change the
    check procedure. At the cost of readability of the code.

    I really wouldn't know how to speed up that routine, short and simple as
    it already is.

    Its simple and good in a sense of readability since it simply "declares"
    what the algorithm of GoL says. But this doesn't mean its the fastest one possible.

    A very easy edit could eventually be (one has to measure if this gives an effect at all) the inclusion of an if then statement wich checks if the
    maximum of three neighbor cells has been reached already and if so leave
    the procedure immediately. There should be an optimal place for such a
    thing and eventually an maximum of such if-then structures since they
    also a need an amount of time. And, its effeciancy depends on state of "filling" of the complete board. E.g. an if c >= 3 then endproc after the
    4th line of if's could be an interesting place for such a structure.

    But thats the easy one. The more effeciant way could be to think about
    the fact, that for every point that runs through this procedure (check)
    every line of neighbours to the left and to the right of the point is
    also a line for another point, namely the +2 point and the -2 point in direction x. The same is true for y, but makes things much more
    complicate. So if one runs through a line in x direction and adds the
    positions that are neighbours y wise ( -x,-y; -x,0; -x-+y ) ( +x,-y;
    +x,0; +x,+y ) and then test the sums it is possible to reuse every sum a
    second time for another point.

    And, away from this idea, wich eventually is not faster because of the
    overhead (one has to test it) its eventually faster in a general way to
    use additions instead of if-then's. Your actual check procedure would
    then transform into a single sum / addtion command of all the neighbours.
    This sum could be tested in a normal way with if sum <= 2 , if sum = 3 ,
    if sum > 3.


    ( ... and in another turn this could (evetnually) be speeded up a little
    bit by defining an "result-array" (DIM nresult% 256) that simply states
    the rules of the game - wich means that for every postion in the array
    the postions of the neighbours are set as bit-on/bit-of, wich works
    perfeclty with 8 bit since there are 8 neighbours at all. With such an construction You never have to check something (if-then) at all because
    only the neighbouring bits of the actual point are "collected" in a byte
    and then this is tested against the result array wich gives back if the
    point should be plotted or not.)


    What I *am* thinking about, is to assign a single bit to
    each cell, rather than a byte. This might speed up things, only if it wouldn't cost extra time to calculate the individual bits involved. But
    even when it would slow down the program marginally, it would
    definitively need 8 times less memory. However, I first have to think
    about a short and effective routine that sets and reads single bits.

    Yes. It depends.
    But, if its good constructed and especially if it uses shifts or is
    written in assembler it should give another boost.


    Eventually You could also announce the next version (or this one here)
    in the comp.sys.acorn.announce and ROOL - its a major step forward.

    Don't you think that people who read the comp.sys.announce will also
    read this group?

    I think they will read. But none of them will read all the items of such
    an thread. So he/she will miss the announcements.

    I don't say You should announce every single and somtimes little steps as
    a new version in c.s.a.announce but if the program makes a big step
    forward - as it has been with the speed up - it should get an new
    "official" announcement to all. You can reuse the old thread in
    c.s.a.announce ... :) if You think, there is not enough place to do so otherwise.


    Thanks for the feed back, very much appreciated!

    If it helps to get a finer and more polished version ...

    on the other side I like to see a new RISCOS "Tool" coming alive.


    All the best,
    SBn

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Sebastian Barthel on Wed Oct 27 16:46:13 2021
    In article <sku720$lfp$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:

    {...} the inclusion of an if then statement wich checks if the maximum
    of three neighbor cells has been reached already and if so leave the procedure immediately. There should be an optimal place for such a
    thing and eventually an maximum of such if-then structures since they
    also a need an amount of time. And, its effeciancy depends on state of "filling" of the complete board. E.g. an if c >= 3 then endproc after
    the 4th line of if's could be an interesting place for such a structure.

    Your suggestion, as well as three other if-then structures in that routine
    that I tried, slow the program down - from noticeable to considerable.
    There's no speed gain whatsoever.

    I've thought about making the routine more efficient for many hours,
    especially about avoiding the duplication of calculations, as you noticed
    in your comment. But avoiding duplicate calculations can't be done without introducing a lot of overhead. The experience with the extra if-then statements as described above discouraged me from even trying.

    A good example is my attempt to store each cell in a bit, rather than in a byte. Unfortunately, we don't have a bit operator for memory blocks, such
    as the ? for bytes, or the ! for words. Setting or clearing a particular
    bit 'n' in a particular byte can be done rather easily by adding or
    subtracting 2^n to or from that byte. But reading a bit is another matter. After a lot of brain crunching I managed to compose a nice little recursive routine that does the job. The necessary memory could then be reduce with a factor 8 indeed. However, the bit-approach slows the program down to such degree, that I had no other choice than forgetting about it completely.

    Of course, all this doesn't mean that speeding up the program can't be
    done. It just means that it can't be done by me.

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nick Roberts@21:1/5 to Paul Sprangers on Wed Oct 27 17:03:06 2021
    In message <59820556e0Paul@sprie.nl>
    Paul Sprangers <Paul@sprie.nl> wrote:

    In article <sku720$lfp$1@solani.org>,
    Sebastian Barthel <naitsabes@freenet.de> wrote:

    {...} the inclusion of an if then statement wich checks if the
    maximum of three neighbor cells has been reached already and if so
    leave the procedure immediately. There should be an optimal place
    for such a thing and eventually an maximum of such if-then
    structures since they also a need an amount of time. And, its
    effeciancy depends on state of "filling" of the complete board.
    E.g. an if c >= 3 then endproc after the 4th line of if's could be
    an interesting place for such a structure.


    I've thought about making the routine more efficient for many hours, especially about avoiding the duplication of calculations, as you
    noticed in your comment. But avoiding duplicate calculations can't be
    done without introducing a lot of overhead. The experience with the
    extra if-then statements as described above discouraged me from even
    trying.

    A good example is my attempt to store each cell in a bit, rather
    than in a byte. Unfortunately, we don't have a bit operator for
    memory blocks, such as the ? for bytes, or the ! for words. Setting
    or clearing a particular bit 'n' in a particular byte can be done
    rather easily by adding or subtracting 2^n to or from that byte. But
    reading a bit is another matter. After a lot of brain crunching I
    managed to compose a nice little recursive routine that does the job.
    The necessary memory could then be reduce with a factor 8 indeed.
    However, the bit-approach slows the program down to such degree, that
    I had no other choice than forgetting about it completely.

    It's a long time since I've used BASIC, so this may be wrong, but
    surely you can read a bit using AND as a binary operator?

    Hence bit 'n' of byte 'b' is set if (b AND (2^n)) is not zero, or
    preferably (b AND (1<<n)).

    Without looking at the program in the large, I wouldn't have thought
    this would give much of a performance hit.

    --
    Nick Roberts tigger @ orpheusinternet.co.uk

    Hanlon's Razor: Never attribute to malice that which
    can be adequately explained by stupidity.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Nick Roberts on Thu Oct 28 09:34:07 2021
    In article <f2600c8259.tigger@bc63.orpheusinternet.co.uk>,
    Nick Roberts <tigger@orpheusinternet.co.uk> wrote:

    Hence bit 'n' of byte 'b' is set if (b AND (2^n)) is not zero, or
    preferably (b AND (1<<n)).

    Hell, that's it! I completely forgot about AND, and only remembered the
    shift. This is the current state of my brains I'm afraid, and it surely
    won't get better. Thanks a lot!

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Drain@21:1/5 to Paul Sprangers on Fri Oct 29 10:10:05 2021
    On 28/10/2021 08:34, Paul Sprangers wrote:
    In article <f2600c8259.tigger@bc63.orpheusinternet.co.uk>,
    Nick Roberts <tigger@orpheusinternet.co.uk> wrote:

    Hence bit 'n' of byte 'b' is set if (b AND (2^n)) is not zero, or
    preferably (b AND (1<<n)).

    Or maybe:

    b%>>n% AND 1

    This always returns 1 or 0 and is a tiny bit faster. ;-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nick Roberts@21:1/5 to Steve Drain on Tue Nov 2 22:51:37 2021
    In message <slgds7$1tb$1@gioia.aioe.org>
    Steve Drain <steve@kappa.me.uk> wrote:

    On 28/10/2021 08:34, Paul Sprangers wrote:
    In article <f2600c8259.tigger@bc63.orpheusinternet.co.uk>,
    Nick Roberts <tigger@orpheusinternet.co.uk> wrote:

    Hence bit 'n' of byte 'b' is set if (b AND (2^n)) is not zero, or
    preferably (b AND (1<<n)).

    Or maybe:

    b%>>n% AND 1

    This always returns 1 or 0 and is a tiny bit faster. ;-)

    It's been a long time since I used Basic, so I plead brain fade for the
    use of %. In C, I just tell the compiler that b and n are integers 8-)


    --
    Nick Roberts tigger @ orpheusinternet.co.uk

    Hanlon's Razor: Never attribute to malice that which
    can be adequately explained by stupidity.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to All on Wed Nov 3 12:21:09 2021
    Dear all,

    In case you're wondering why there hasn't been a new update since two weeks
    or so, well... there is one: 1.11c. However, it only has some minor improvements, partly based upon the suggestions made by others, in
    particular Sebastian Barthel.

    My intention was to reduce memory significantly by storing cells in bits, rather than in bytes, but although I more or less succeeded in doing so, there's still a really weird bug that I can't put my fingers on. Moreover,
    in spite of Nick's and Steve's elegant bit operators, the result is still noticeably slower than the version based upon bytes. I haven't yet given
    up, but I'll park it for the time being.

    Download as always from: http://www.riscos.sprie.nl/sprang.riscos/Downloads/GoL.zip

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Drain@21:1/5 to Paul Sprangers on Wed Nov 3 15:01:02 2021
    On 03/11/2021 11:21, Paul Sprangers wrote:

    Moreover, in spite of Nick's and Steve's elegant bit operators, the
    result is still noticeably slower than the version based upon bytes.
    A little while back Martin Avison and I worked on providing bit and byte
    arrays for BASIC via a CALL. They were great for saving memory, but
    there was a significant penalty in speed over using indirection.
    Accessing bits in just BASIC is very much slower again.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Steve Drain on Thu Nov 4 17:30:52 2021
    In article <slu8bs$1gl4$1@gioia.aioe.org>,
    Steve Drain <steve@kappa.me.uk> wrote:

    A little while back Martin Avison and I worked on providing bit and byte arrays for BASIC via a CALL. They were great for saving memory, but
    there was a significant penalty in speed over using indirection.
    Accessing bits in just BASIC is very much slower again.

    That confirms my experience. If even Martin and you came to this
    conclusion, then I will now certainly forget about bitting the game.

    Setting and reading bits in computer memory seems so fundamental, that it's weird to find out that it isn't easy at all (well, it may be easy, but unexpectedly time consuming). Thank you for sharing your thoughts and experience.

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From druck@21:1/5 to Paul Sprangers on Thu Nov 4 19:19:26 2021
    On 04/11/2021 16:30, Paul Sprangers wrote:
    Setting and reading bits in computer memory seems so fundamental, that it's weird to find out that it isn't easy at all (well, it may be easy, but unexpectedly time consuming). Thank you for sharing your thoughts and experience.

    It's a case of using the correct tool for the job. An interpreted
    language has a large overhead determining the additional arithmetic
    operations needed to get or set each bit within a byte or word.

    But a compiled language, particularly C which was designed to twiddle
    bits as efficiently as possible, can mean the reduction in the amount of
    memory passing through the data cache more than makes up for the
    additional arithmetic instructions needed. So using bits may be a lot
    faster than bytes for large amount of data.

    ---druck

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to druck on Fri Nov 5 10:27:27 2021
    In article <sm1bo2$ur8$1@dont-email.me>,
    druck <news@druck.org.uk> wrote:

    But a compiled language, particularly C which was designed to twiddle
    bits as efficiently as possible, can mean the reduction in the amount of memory passing through the data cache more than makes up for the
    additional arithmetic instructions needed. So using bits may be a lot
    faster than bytes for large amount of data

    No doubt that's true. The need of learning C is something that I postponed
    to my retirement. Now that I am, I find it even difficult to remember the common Wimp things in Basic. Erm... any recommendation for a good start for
    C in RISC OS?

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From druck@21:1/5 to Paul Sprangers on Sun Nov 7 19:10:01 2021
    On 05/11/2021 09:27, Paul Sprangers wrote:
    No doubt that's true. The need of learning C is something that I postponed
    to my retirement. Now that I am, I find it even difficult to remember the common Wimp things in Basic. Erm... any recommendation for a good start for
    C in RISC OS?

    I don't have any specific recommendations, but Wimp programming is a lot
    easier in C than BASCIC. Wimp calls in BASIC take blocks of memory and
    you have to know offset and type of each field to use with indirection operators. In C each call takes or returns a C structure which contains
    named and typed fields, meaning you don't have to remember offsets, and
    the compiler can check you've used the correct type.

    ---druck

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Matthew Phillips@21:1/5 to All on Sun Nov 7 20:12:05 2021
    In message <sm98a9$72b$1@dont-email.me>
    on 7 Nov 2021 druck wrote:

    On 05/11/2021 09:27, Paul Sprangers wrote:
    No doubt that's true. The need of learning C is something that I postponed to my retirement. Now that I am, I find it even difficult to remember the common Wimp things in Basic. Erm... any recommendation for a good start for C in RISC OS?

    I don't have any specific recommendations, but Wimp programming is a lot easier in C than BASIC. Wimp calls in BASIC take blocks of memory and you have to know offset and type of each field to use with indirection
    operators. In C each call takes or returns a C structure which contains
    named and typed fields, meaning you don't have to remember offsets, and
    the compiler can check you've used the correct type.

    Well, you can make C just as hard as BASIC if you make all the calls using _kernel_swi or similar! For an example of that approach (not recommended)
    see the series by Paul Johnson in Archive many years ago.

    If you use OSLib, or a higher-level library like Desk, DeskLib or Steve Fryatt's SFLib, then I would agree, C is easier than BASIC.

    See https://www.stevefryatt.org.uk/risc-os/wimp-prog for Steve's tutorial on Wimp programming in C. You could do a lot worse than follow his guide. I've dipped into a few of his tutorials and it looks very well presented and full
    of good advice.

    --
    Matthew Phillips
    Durham

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Drain@21:1/5 to Matthew Phillips on Mon Nov 8 09:49:38 2021
    On 07/11/2021 20:12, Matthew Phillips wrote:

    Well, you can make C just as hard as BASIC if you make all the calls using _kernel_swi or similar! For an example of that approach (not recommended) see the series by Paul Johnson in Archive many years ago.

    If you use OSLib, or a higher-level library like Desk, DeskLib or Steve Fryatt's SFLib, then I would agree, C is easier than BASIC.

    So, it comes down to the quality of the library you use then. Perhaps,
    if you have a good quality BASIC library then C is not so much easier. ;-)

    For desktop applications with BASIC I would recommend using the Toolbox,
    and most of those structure problems disappear. I am happy to write my
    own library, but AppBasic is the obvious suggestion for a general
    library, and it has excellent tutorials.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From druck@21:1/5 to Steve Drain on Mon Nov 8 11:49:04 2021
    On 08/11/2021 09:49, Steve Drain wrote:
    On 07/11/2021 20:12, Matthew Phillips wrote:

    Well, you can make C just as hard as BASIC if you make all the calls
    using
    _kernel_swi or similar!  For an example of that approach (not
    recommended)
    see the series by Paul Johnson in Archive many years ago.

    If you use OSLib, or a higher-level library like Desk, DeskLib or Steve
    Fryatt's SFLib, then I would agree, C is easier than BASIC.

    So, it comes down to the quality of the library you use then. Perhaps,
    if you have a good quality BASIC library then C is not so much easier. ;-)

    No matter how good a BASIC library is, it can't get around the problem
    that BASIC does not have rich enough data types to interact with the
    Wimp, without resorting to memory blocks and indirection operators.

    For desktop applications with BASIC I would recommend using the Toolbox,
    and most of those structure problems disappear. I am happy to write my
    own library, but AppBasic is the obvious suggestion for a general
    library, and it has excellent tutorials.

    I'm not sure using Toolbox overcomes the problem I've described, it
    still requires a set of rich data types, which BASIC can't do.

    ---druck

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kevin Wells@21:1/5 to Steve Drain on Mon Nov 8 11:06:51 2021
    In message <smaru5$130f$1@gioia.aioe.org>
    Steve Drain <steve@kappa.me.uk> wrote:

    On 07/11/2021 20:12, Matthew Phillips wrote:

    Well, you can make C just as hard as BASIC if you make all the calls using >> _kernel_swi or similar! For an example of that approach (not recommended) >> see the series by Paul Johnson in Archive many years ago.

    If you use OSLib, or a higher-level library like Desk, DeskLib or Steve
    Fryatt's SFLib, then I would agree, C is easier than BASIC.

    So, it comes down to the quality of the library you use then. Perhaps,
    if you have a good quality BASIC library then C is not so much easier. ;-)

    For desktop applications with BASIC I would recommend using the Toolbox,
    and most of those structure problems disappear. I am happy to write my
    own library, but AppBasic is the obvious suggestion for a general
    library, and it has excellent tutorials.

    Another one to consider is Dr Wimp for the same reasons.


    --
    Kev Wells
    http://kevsoft.co.uk/ https://ko-fi.com/kevsoft
    carpe cervisium
    But it's " Saviour of 'is country " when the guns begin to shoot;

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Drain@21:1/5 to druck on Mon Nov 8 18:21:27 2021
    On 08/11/2021 11:49, druck wrote:

    I'm not sure using Toolbox overcomes the problem I've described, it
    still requires a set of rich data types, which BASIC can't do.

    Of course, it does not remove all use of indirection, but the many
    window, icon and menu structures are no longer needed. Any decent
    library will hide the small amount necessary. That still leaves memory management and event handling though. I agree, those who can should use
    C, but BASIC can be used in pretty 'easy' way. ;-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Barthel@21:1/5 to All on Sat Nov 13 12:13:10 2021
    Am Mon, 08 Nov 2021 11:06:51 +0000 schrieb Kevin Wells:

    In message <smaru5$130f$1@gioia.aioe.org>
    Steve Drain <steve@kappa.me.uk> wrote:

    On 07/11/2021 20:12, Matthew Phillips wrote:

    Well, you can make C just as hard as BASIC if you make all the calls
    using _kernel_swi or similar! For an example of that approach (not
    recommended)
    see the series by Paul Johnson in Archive many years ago.

    If you use OSLib, or a higher-level library like Desk, DeskLib or
    Steve Fryatt's SFLib, then I would agree, C is easier than BASIC.

    So, it comes down to the quality of the library you use then. Perhaps,
    if you have a good quality BASIC library then C is not so much easier.
    ;-)

    For desktop applications with BASIC I would recommend using the Toolbox, >>and most of those structure problems disappear. I am happy to write my
    own library, but AppBasic is the obvious suggestion for a general
    library, and it has excellent tutorials.

    Another one to consider is Dr Wimp for the same reasons.


    And then there is (better: was) the very great "Gamesuite" by Andy
    Southgate to speed up the things a little bit if necessary.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Barthel@21:1/5 to All on Sat Nov 13 12:57:43 2021
    Am Sun, 07 Nov 2021 20:12:05 +0000 schrieb Matthew Phillips:

    In message <sm98a9$72b$1@dont-email.me>
    on 7 Nov 2021 druck wrote:

    On 05/11/2021 09:27, Paul Sprangers wrote:
    ... The need of learning C is something that I
    postponed to my retirement. Now that I am, I find it even difficult
    to remember the common Wimp things in Basic. Erm... any
    recommendation for a good start for C in RISC OS?

    I don't have any specific recommendations, but Wimp programming is a
    lot easier in C than BASIC.

    Well, you can make C just as hard as BASIC if you make all the calls
    using _kernel_swi or similar! For an example of that approach (not recommended) see the series by Paul Johnson in Archive many years ago.

    If you use OSLib, or a higher-level library like Desk, DeskLib or Steve Fryatt's SFLib, then I would agree, C is easier than BASIC.

    See https://www.stevefryatt.org.uk/risc-os/wimp-prog for Steve's
    tutorial on Wimp programming in C.

    That's a very good course - for the RISCOS side of C. Especially because
    it comes with a mass of good and directly usable code snippets.


    But for a general introduction in C and the first steps in or into this
    world of classic programming there are other courses wich are better for
    a general understanding an basic structural knowledge of this dialect.

    In newer times (and much more since 2020 with people sitting in front of
    their laptop) the eventually best way to get its foots into an new land
    of code one could go to Youtube an take a short lesson of C

    e.g.

    <https://www.youtube.com/watch?v=3lQEunpmtRA>

    C Programming | In One Video

    <https://www.youtube.com/watch?v=KJgsSFOSQv0>

    C Programming Tutorial for Beginners

    or

    <https://www.youtube.com/watch?v=CPjZKsUYSXg>

    C Programming Tutorial 1 - Intro to C


    and many more

    and there are some very interesting "historic" lessons about it

    https://www.youtube.com/watch?v=de2Hsvxaf8M

    "C" Programming Language: Brian Kernighan - Computerphile




    After clicking and looking around there (YT) the next best step is to get
    a GOOD book to learn the basics. There are many(!) books. And no one knows
    wich the BEST may be.


    But e.g.

    <https://www.lovelybooks.de/autor/Dirk-Louis/C-C-Kompendium-m-CD- ROM-1327909950-w/>

    is a good choice. But, its massive and in the first run the C++ Parts are
    of no interest.


    The classic introduction, and not the worst today, is the

    <https://archive.org/details/TheCProgrammingLanguageFirstEdition/mode/2up>

    The C Programming Language

    It has all the things one has to know about the C.

    There are newer editions and the book is available second hand for very
    little.



    For the "real programming thing" its absolutely necessary to have an
    quick overview of all the quirky stuff C does in its sometimes very
    special form of doing things. My favorite for this is

    https://www.oreilly.com/library/view/c-pocket-reference/0596004362/

    C Pocket Reference
    by Peter Prinz, Ulla Kirch-Prinz



    If You are a german reader the website

    https://www.c-howto.de/tutorial/

    is a very short but handy introduction to C.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Fryatt@21:1/5 to Sebastian Barthel on Sat Nov 13 13:43:18 2021
    On 13 Nov, Sebastian Barthel wrote in message
    <smoco7$21j$2@solani.org>:

    After clicking and looking around there (YT) the next best step is to get
    a GOOD book to learn the basics. There are many(!) books. And no one knows wich the BEST may be.

    Here's the one that I learned from (it was the required course text book
    back when I was an engineering student sitting in on first year computer science):

    https://www.waterstones.com/book/book-on-c-a/al-kelley/ira-pohl/9780201183993

    https://www.amazon.co.uk/Book-C-Programming/dp/0201183994/

    It's a while since I've looked at it, but it always seemed to be more comprehendible than other books on the subject.

    --
    Steve Fryatt - Leeds, England

    http://www.stevefryatt.org.uk/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Barthel@21:1/5 to All on Mon Nov 15 01:05:28 2021
    Am Sun, 07 Nov 2021 20:12:05 +0000 schrieb Matthew Phillips:

    In message <sm98a9$72b$1@dont-email.me>
    on 7 Nov 2021 druck wrote:

    On 05/11/2021 09:27, Paul Sprangers wrote:
    ... . Erm... any
    recommendation for a good start for C in RISC OS?

    I don't have any specific recommendations, but Wimp programming is a
    lot easier in C than BASIC. Wimp calls in BASIC take blocks of memory
    and you have to know offset and type of each field to use with
    indirection operators. In C each call takes or returns a C structure
    which contains named and typed fields, meaning you don't have to
    remember offsets, and the compiler can check you've used the correct
    type.

    Well, you can make C just as hard as BASIC ...

    If you use OSLib, or a higher-level library like Desk, DeskLib or Steve Fryatt's SFLib, then I would agree, C is easier than BASIC.

    See https://www.stevefryatt.org.uk/risc-os/wimp-prog for Steve's
    tutorial on Wimp programming in C.

    There are some very interesting short introductions and "overviews" wich
    are good to get some "feeling" about what can be done with this language.

    When this "C" arrived at the lands of homecomputing a massive lot of
    articles began to praise the idiom, its power and strength. But this
    depends. Today a closer look at Python, which is available for RISCOS,
    could be a good idea too.

    Here is an example of such a "C" advertising

    https://archive.org/details/PersonalComputerWorld1983-04/page/128/mode/2up

    PCW 1983 April




    And here is some simple line of code, that looks like nonsense but is
    correct in C (and very close to the machine)


    while (n--) {
    do something
    }


    It has/is a form of magic - but only to the initiated apologists ... :)

    And its full of its own wonders. No other language can do this to the
    people. Probably thats the real reason of its massive utilisation.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to All on Wed Dec 1 17:35:25 2021
    Dear all,

    Version 1.13 of !GoL is ready for download.

    Apart from some bug fixes, a new logo, a larger grid, and a far more
    intuitive manipulation of the grid dimensions, !GoL can now also read some
    of the many alien Life file formats. A lot of time has been put into the extraction of the 700+ patterns from the official Life Lexicon library (https://bitstorm.org/gameoflife/lexicon/). As a bonus, the program comes
    with 3 other archives, one of which contains the shapes that Chris Taylor included in his magnificent !MacroLife. The manual is partly revised.

    Download: www.riscos.sprie.nl/sprang.riscos/Downloads/GoL.zip

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jean-Michel@21:1/5 to Paul Sprangers on Sat Dec 11 10:58:13 2021
    Hi
    In message <599415982bPaul@sprie.nl>
    Paul Sprangers <Paul@sprie.nl> wrote:

    Dear all,

    Version 1.13 of !GoL is ready for download.

    Apart from some bug fixes, a new logo, a larger grid, and a far more intuitive manipulation of the grid dimensions, !GoL can now also read some
    of the many alien Life file formats. A lot of time has been put into the extraction of the 700+ patterns from the official Life Lexicon library (https://bitstorm.org/gameoflife/lexicon/). As a bonus, the program comes with 3 other archives, one of which contains the shapes that Chris Taylor included in his magnificent !MacroLife. The manual is partly revised.

    Download: www.riscos.sprie.nl/sprang.riscos/Downloads/GoL.zip

    Kind regards,
    Paul

    Thank you for this new version.
    when editing a new grid, if the chosen shape is a square, it is not drawn correctly and the window must be refreshed "manually".

    This problem disappears if we use circles.

    --
    Jean-Michel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Jean-Michel on Sat Dec 11 11:58:29 2021
    In article <bd96179959.jmb@jmc.bruck.orange.fr>,
    Jean-Michel <jmc.bruck@orange.fr> wrote:

    when editing a new grid, if the chosen shape is a square, it is not
    drawn correctly and the window must be refreshed "manually".
    This problem disappears if we use circles.

    I think this is a 'rounding' problem. The grid isn't created by drawing
    lines, but by plotting square characters from the Selwyn font. In order to achieve a grid of any possible size, the font size is defined by rational numbers, rather than by integers. Its precision however isn't infinite,
    reason why some dimensions produce ugly grids, or produce traces when a
    black square is deleted. The effect is as unpredictable as the game itself. Using circles doesn't really change this, but reduces the effect to nearly invisible. Making some tiny adjustments to the dimensions of the grid is usually enough to get rid of the effect.

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to All on Sun Dec 12 15:14:38 2021
    Dear all,

    Just a quick note that version 1.13b is ready for download. The previous version had a nasty bug in reading alien file formats, which affected some
    of the shapes of !MacroLife.

    Download: www.riscos.sprie.nl/sprang.riscos/Downloads/GoL.zip

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to All on Thu Dec 16 18:31:37 2021
    Dear all again,

    At the risk that everyone will yawn, I herewith announce another update of
    the Game of Life, version 1.14.

    What is new?
    I've abandoned the idea of plotting Selwyn characters to draw the grid, and
    now use the LINE, RECTANGLE and CIRCLE commands instead. Not only cause
    these a performance increase of 30% (to my surprise, actually), they also
    draw a new large grid at the blink of an eye, rather than the seconds on previous versions. The whole program is much more responsive now.
    And there's a number of bug fixes and little improvements that can be found
    in the History file.

    What is old?
    Other bugs remain, particularly the strange traces in some combinations of
    cell size and screen mode. Not as many as in previous versions, but they haven't yet all disappeared.

    Download from www.riscos.sprie.nl/sprang.riscos/Downloads/GoL.zip

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sniffer@21:1/5 to Paul Sprangers on Thu Dec 16 20:27:12 2021
    On 16/12/2021 17:31, Paul Sprangers wrote:
    Dear all again,

    At the risk that everyone will yawn, I herewith announce another update of the Game of Life, version 1.14.


    Not yawning but, there is c.s.a.announce for, bizarrely, announcements :-)

    FYI, on a separate note, each time you post 'New prog: Game of Life'
    here, you are actually creating a new thread, as opposed to posting on
    your original thread. This causes havoc with threaded displays.

    Cheers,
    Mike.
    --

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Sniffer on Thu Dec 16 22:57:40 2021
    In article <spg7f0$uo7$1@dont-email.me>,
    Sniffer <sniffer@dewberryfields.co.uk> wrote:

    FYI, on a separate note, each time you post 'New prog: Game of Life'
    here, you are actually creating a new thread, as opposed to posting on
    your original thread. This causes havoc with threaded displays.

    Really? That's not what I see here. All postings are grouped within the
    same single thread. As I understand things, I would have started a new
    thread when announcing something on comp.sys.announce - and I don't want to abuse that one for minor updates only. But maybe I just don't understand
    things (an increasing problem, by the way).

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sniffer@21:1/5 to Paul Sprangers on Fri Dec 17 09:36:51 2021
    On 16/12/2021 21:57, Paul Sprangers wrote:
    In article <spg7f0$uo7$1@dont-email.me>,
    Sniffer <sniffer@dewberryfields.co.uk> wrote:

    FYI, on a separate note, each time you post 'New prog: Game of Life'
    here, you are actually creating a new thread, as opposed to posting on
    your original thread. This causes havoc with threaded displays.

    Really? That's not what I see here. All postings are grouped within the
    same single thread.

    Interesting, not here. Latterly your posts of updates have been
    appearing in their own thread. I need to see what's going wrong at my
    end as I have been following with interest.

    As I understand things, I would have started a new
    thread when announcing something on comp.sys.announce - and I don't want to abuse that one for minor updates only.

    But that's what it's for. Pretty much single thread announcements, but I
    guess, it's only etiquette.

    Cheers,
    Mike.
    --

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Sniffer on Fri Dec 17 11:02:59 2021
    In article <sphlnj$t9f$1@dont-email.me>,
    Sniffer <sniffer@dewberryfields.co.uk> wrote:

    Latterly your posts of updates have been
    appearing in their own thread. I need to see what's going wrong at my
    end as I have been following with interest.

    I don't think there's anything wrong at either side. You seem to use Thunderbird on Windows for accessing the news groups, while I use Pluto on
    RISC OS. I guess both systems have their own defaults of displaying and grouping threads and posts - defaults that probably may be user adjusted...

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sniffer@21:1/5 to Paul Sprangers on Fri Dec 17 10:34:37 2021
    On 17/12/2021 10:02, Paul Sprangers wrote:
    In article <sphlnj$t9f$1@dont-email.me>,
    Sniffer <sniffer@dewberryfields.co.uk> wrote:

    Latterly your posts of updates have been
    appearing in their own thread. I need to see what's going wrong at my
    end as I have been following with interest.

    I don't think there's anything wrong at either side. You seem to use Thunderbird on Windows for accessing the news groups, while I use Pluto on RISC OS. I guess both systems have their own defaults of displaying and grouping threads and posts - defaults that probably may be user adjusted...

    Yes we use different clients, that can be seen in the headers and yes,
    those clients may behave differently but, even using Google Groups
    (which c.s.a.apps belongs to) to display postings shows separate threads
    for 'Re: New prog: Game of Life'.

    Adding to this confusion for me is that I don't see your original post
    anywhere other than being referenced in the first reply by Sebastian
    Barthel.

    Hey Ho! No big deal. :-)

    Cheers,
    Mike.
    --

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Sprangers@21:1/5 to Sniffer on Sat Dec 18 12:36:36 2021
    In article <sphp3t$84k$1@dont-email.me>,
    Sniffer <sniffer@dewberryfields.co.uk> wrote:

    even using Google Groups (which c.s.a.apps belongs to) to display
    postings shows separate threads for 'Re: New prog: Game of Life'.

    I think it's my fault after all. Sometimes I've announced an update by
    clicking on the thread, rather than replying to someone in that thread. Although Pluto understands that I'm still in the same thread, Google
    apparently thinks that I'm making a new one. For future announcements I
    will always reply to someone.

    Kind regards,
    Paul

    --
    http://www.riscos.sprie.nl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)