Jump to content

Conway's Game Of Life

Recommended Posts

Well, I looked around for this elsewhere but only found an implementation using asterisks and spaces. It didn't update too good either. I made this in a spare hour today; thought I'd throw it out there for fun.

The code can be downloaded from HERE.

It's not a complete work by any means. Ideally there'd be an associated UI and the ability to set your own starting pattern. Use the Global Const to make changes as required. Beware that it sucks CPU if you set the $timerDelay down too low.

Have fun.


EDIT: 4-June-2009

You now have the ability to set your own starting pattern which you can draw with the mouse.

Press "R" to set a random pattern

Press "C" to clear the pattern

Press "F5" to run the pattern

Edited by WideBoyDixon
Link to comment
Share on other sites

By the way:

An example of a modified "Game of Life" visualization is present in YahELite's "/egg 2" command. [if in doubt, check the credits for YahELite, Conway is listed :D ]

[sS]Posted Image

Quite a strange and psychedelic display.

I'm also tempted to try something similar, but we'll see how much free time I have first.

Edit: I found This page containing an applet for another implementation. (Source available)

Edit: and this.

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

Updated. See the first post for details. It's also a little more efficient (hopefully) on the drawing code since it doesn't draw cells that haven't changed from one iteration to the next.


Link to comment
Share on other sites

Looks really nice WBD. I had this always in mind to code GoL, too!

Personally the grid color is too bright. It looks better when it set darker, e.g. Global $hPen = _GDIPlus_PenCreate(0x7F3F3F3F) (my subjective opinion).

Keep your good work up!


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

UEZ I think you're right about the grid. The other thing I never mentioned about the code is the function to create an angled gradient line brush; I haven't seen this elsewhere so perhaps it might be useful to someone.


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...