RIP John Conway

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 261
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: RIP John Conway

Post by SWEdeAndy » Tue May 19, 2020 2:33 pm

Oh, just one problem I noticed in your version, Thierry: The pause button doesn't work now, it instantly switches to 'play' again. Commenting out the lines 180-181 in card script fixes that. But then instead it won't stop at no-change status, so some further code is needed to restore full play/pause functionality.
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: RIP John Conway

Post by Thierry » Tue May 19, 2020 3:12 pm

SWEdeAndy wrote:
Tue May 19, 2020 2:33 pm
Oh, just one problem I noticed in your version, Thierry: The pause button doesn't work now.
Mmm, must have zipped the wrong one, as it works fine here
Otherwise how could I have the results I did show in my previous post :wink:
I'll upload another one later on...
Thanks
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: RIP John Conway

Post by Thierry » Tue May 19, 2020 3:21 pm

SWEdeAndy wrote:
Tue May 19, 2020 2:27 pm
Thanks for the improvements, Thierry. I learn a lot from comparing your code with mine.
Thanks Andreas,

But honestly, I read your code first and then made the changes;
so most merits for you :)
Faster than that and it would be hard for the eye to follow the pattern changes,
which would make it less entertaining to watch. :)
Oh, I was expecting that you get caught into it
and wanted to do some more improvement.... :)

If it becomes too fast, then add a scroller to your UIs to manage the timer
in the main loop: send "NextGeneration" in timer milliseconds.

Thanks for sharing your stack,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: RIP John Conway

Post by Thierry » Tue May 19, 2020 4:40 pm

here is a new version correcting the bug mentioned by Andreas.

GameOfLife-Thierry.livecode.zip
(93.04 KiB) Downloaded 183 times

For those who have already downloaded the 1st,
you can edit the card script
and modify it this way:

-- drop the send "mouseUp" to widget ...
-- comment out: set the iconPresetName of widget "PlayPause" to "play"

-- and further down, replace: if cellsChange[ X][ Y] is not empty then
-- by: if cellsChange[ X][ Y] then

New code:

Code: Select all

   
   if isAnyChange and \
         the iconPresetName of widget "PlayPause" is "pause" then
      send "nextGeneration" to me in 1 ticks
   else
      -- no change happens on the entire board: Stop!
      -- or user press the 'PlayPause' button
      beep 2
      set the iconPresetName of widget "PlayPause" to "play"
      show grp "OtherButtons"
   end if
end nextGeneration

command displayNextGenerationDelta @cellsChange
   lock screen
   repeat with X = 1 to N_COLUMNS
      repeat with Y = 1 to N_ROWS
         if cellsChange[ X][ Y] then \
               cellNewState board[ X][ Y][_ID], board[ X][ Y][_NEXT]
         put board[ X][ Y][_NEXT] into board[ X][ Y][_NOW]
      end repeat
   end repeat
end displayNextGenerationDelta
Thanks,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

okk
Posts: 176
Joined: Wed Feb 04, 2015 11:37 am

Re: RIP John Conway

Post by okk » Wed May 20, 2020 5:46 pm

Hi, I wanted to take up the issue with the different facebook groups etc. and the question of consolidating different silos of knowledge. It appeared earlier in this thread but it felt impolite to continue this discussion here since this thread is dedicated to John. I started a new one here. https://forums.livecode.com/viewtopic.p ... 23#p191891

Chime in if you feel like. Thanks. Oliver

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 261
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: RIP John Conway

Post by SWEdeAndy » Thu May 21, 2020 5:11 pm

Thierry wrote:
Tue May 19, 2020 3:21 pm

Oh, I was expecting that you get caught into it
and wanted to do some more improvement.... :)
Oh, I would like to for sure! But I have so many projects going on, so this one will have to rest for a while... :)

You are of course right that "too fast" is never a problem, as it can just be slowed down if needed.

Other things on the improvement list could be:
- better boundary handling (the array could extend beyond the visible grid and handle life/death events correctly there)
- allow the user to modify the size of the window and the grid (I made it quite big as I have a large external screen, but it doesn't actually fit on my laptop screen)
- "painting" dots . i.e. drag mouse to turn them on/off, instead of clicking on each
- "stamping" or moving predefined seeds anywhere on the grid, instead of them just appearing where they where saved
- recording/logging every step to enable stepping backwards to interesting points in time
etc..

I'm sure the most advanced simulators (and there must be thousands, as Game of Life seems to be a popular exercise in all programming languages) have all these features and a bunch more that I fail to imagine. :D

Maybe someone else in the LC community wants to carry the baton and advance our joint stack up the feature ladder? :)
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: RIP John Conway

Post by Thierry » Thu May 21, 2020 5:34 pm

SWEdeAndy wrote:
Thu May 21, 2020 5:11 pm
Thierry wrote:
Tue May 19, 2020 3:21 pm
Oh, I was expecting that you get caught into it
and wanted to do some more improvement.... :)
Oh, I would like to for sure!
But I have so many projects going on, so this one will have to rest for a while... :)
Same for me.

My interest when I came in, was to improve the speed of the core game;
well, I've done my job, refreshing old knowledge in the process :)
Other things on the improvement list could be:
- better boundary handling (the array could extend beyond the visible grid and handle life/death events correctly there)
- allow the user to modify the size of the window and the grid (I made it quite big as I have a large external screen, but it doesn't actually fit on my laptop screen)
- "painting" dots . i.e. drag mouse to turn them on/off, instead of clicking on each
- "stamping" or moving predefined seeds anywhere on the grid, instead of them just appearing where they where saved
- recording/logging every step to enable stepping backwards to interesting points in time
etc..
All those features are quite easy to implement...
of course with some time.

Maybe someone else in the LC community wants to carry the baton
and advance our joint stack up the feature ladder? :)
Actually, it's a nice project for those wanting to learn deeper LiveCode.
So, who's the next ?

Best,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: RIP John Conway

Post by mwieder » Thu May 21, 2020 6:50 pm

I'm not sure boundary handling is so much of an issue. I envisioned a bounded infinite surface where exiting from one edge would enter the opposite one. That way it sort of maps the playing field onto a hypersphere.

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 261
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: RIP John Conway

Post by SWEdeAndy » Thu May 21, 2020 7:34 pm

mwieder wrote:
Thu May 21, 2020 6:50 pm
I'm not sure boundary handling is so much of an issue. I envisioned a bounded infinite surface where exiting from one edge would enter the opposite one. That way it sort of maps the playing field onto a hypersphere.
Yes, that's one solution. If I remember correctly (I read up a little on Game of Life theory back in February when this came up in the FB group), the common ways of handling the boundary are:
- No handling, just treat all cells outside the boundary as permanently dead (this is the 'lazy' way, and the way I did it).
- Handle outside cells by making the virtual grid (the array where stuff is computed) larger than the visual one, so that e.g. gliders exit correctly.
- Treat the area as a hypersphere where e.g. exiting gliders enter on the opposite side (like you describe it).
- 'Follow the action', where the visible area 'moves' with a glider so that it never exits (hard to determine which action to follow though, if several objects are developing in different directions...).

In the best simulator, all of them would be implemented, and you can choose at any moment which one you want to test. :)
Last edited by SWEdeAndy on Thu May 21, 2020 8:21 pm, edited 1 time in total.
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: RIP John Conway

Post by mwieder » Thu May 21, 2020 7:37 pm

In the best simulator, all of them would be implemented, and you can choose at any moment which one you want to test. :)
Ha! 8)

Post Reply

Return to “Off-Topic”