Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

C# Conway's Game of Life Example

Loading...

Sign in or sign up now!
6,198
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Apr 27, 2008

Quick and dirty GoL implementation in C# .NET 2.0 using Windows Forms. The application has a few pre-loaded patterns but also allows users to create their own by clicking inside the display area. For more information on the Game of Life, check out the following site:

http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

Note that I've added the ability for the live units to "wrap" around the edges. Without that wrapping, the preloaded patterns would run forever without dying out.

EDIT:
I've had a bunch of people ask me to clarify what I meant by drawing on a bitmap and setting it to a picturebox so I created a real quick example. It also includes how to calculate which cell in the board was clicked. You can find it below:

www.exceptionthrown.com/DrawingOnABitmap.zip

Category:

Science & Technology

Tags:

License:

Standard YouTube License

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (exceptionthrown)

  • nice program. How long did it take to write?

  • The initial application only took a few hours. It uses Windows Forms (.NET 2.0). The part that actually shows the cells is really a picturebox with a bitmap set as it's background. I basically run the GOL algorithm on a 2-D array, draw to a Bitmap object, then set that object as the picturebox's background. It actually worked out pretty well. It isn't demonstrated in the video, but you can click on cells to set their status to alive or dead, which means you can create your own patterns as well.

  • nice work,

    could you send the code of this

  • I would love to but unfortunately it was lost along with my XNA Maze Generator source :(

    If I get some free time I plan on re-creating them though.

see all

All Comments (5)

Sign In or Sign Up now to post a comment!
  • Looks nice!

    I've written one too with some more features (also made a video of it ;-) ). Maybe I will also add an option to show recently died cells.

    Good work!

  • looks good :)

  • nicely dne

Loading...
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more