OK, for those of you who are new here, I like to do things that have never been done (and should never be done again!)!
The stupid idea I had this...
For further actions, you may consider blocking this person and/or reporting abuse
Oooh! Kindred soul making GoL in unexpected languages! This was fun to read!
I did it in 100% CSS not long ago :)
codepen.io/propjockey/pen/NWEYdjY?...
I saw this and loved it...in fact I was originally going to do it in CSS until I saw this, and so I chose SQL instead!
Amazing work! 💪🏼💗
Very cool. If you really want to drive yourself nuts with this, try doing the same without using PL/pgSQL. Using common table expressions, you can use recursion, which makes PostgresSQL a Turing Complete language without PL/pgSQL.
Example demonstrating Turing Completeness: wiki.postgresql.org/wiki/Cyclic_Ta...
Related Stackoverflow answer that happens to include a link to the Mandelbrot set in PostgresSQL: stackoverflow.com/a/7580013
Direct link to the Mandelbrot example: wiki.postgresql.org/wiki/Mandelbro...
This reminded me of something I wrote 12 years go. It should still work, no procedural code. I went and found the source:
These days I don't do much SQL anymore, but I used to treat every query as a puzzle :)
Nice, few tricks in there for me to learn from! 💗
Ooohhh, perhaps not this, but I can think of some fun things to try using Recursion! Thanks! 💗
You're welcome
Its very nice to see others learning this way. I love to come up with silly ideas and then learn by implimenting them. I am currently making a turn based castle builder game that runs in a browser using pure vanilla js.
Nice, I hope to see you post it here when it is done! 💪🏼💗
Thats the plan!
It's So Cool, I have also done something similar unique I've created the Convoy's game of life in command line. Medium
Just FYI, PostgreSQL supports points as datatypes, which might be more efficient for this :) Read more on their documentation at here
This aside, interesting article. Great job!
Do you have any examples of usage as just by definition alone I am not seeing how points vs 2 columns for x and y save any operations.
The inefficiency in my code is from loops and lots of UPDATES and my WHERE query? Is there any specific "function" that I can use (like SERIES) with these.
As I said, just learning so I am far from understanding all of the parts!
Thanks in advance! 💗💗
I modified the schema a bit, assuming that all points in the table are assumed to be alive, and if a point isn't there, then it is dead.
New schema:
and now the power of it.. To get all adjacent points that are alive, I just need to run this:
the <-> operator returns the distance of two geometric objects, points in this case.
You can probably figure out how to go on :)
Relevant documentation: postgresql.org/docs/current/functi...
This is cool. I am going to try this for fun
Haha, let me know how you get on! 😂💗
Using tools to make applications it was never intended for. Funny and really interesting at the same time. Amazing post ❤️
Very cool and creative, congrats
Impressive article, lots of detail here for people to get their teeth into. Thanks for sharing!
On a scale from silly to spectacular...how do you rate this one then? 😂💗