I just finished up my first pass on Conway's Game of Life with the Ruby version of Gosu while watching season 2 of Dexter. It's ripe for refactor and I still have some work to do to make it worth running, but yeah, first pass.
To run it, you just need to run init.rb
ruby init.rb
Tags: game of life, gosu, ruby
I've made a small date to my interpretation of Conway's Game of Life yet again. Now instead of generating a random graph you can actually click on tiles to turn them "on" or "off".
Here's the code and here's how it do.
You can find the older versions of the files here: http://joezack.com/index.php/tag/game-of-life/
Tags: game of life, javascript
I changed up the code up a little bit for implementation of Conway's Game Of Life. Turns out I had misread the rules a bit. My original code turned all cells on when they had 2 or 3 neighbors, regardless of their current state. That's how live cells are supposed to work, but dead cells are only supposed to change their state when they have exactly 3 neighbors.
Also I've updated my JavaScript objects to use the Prototype Class.create method. As far as I know the method I had been using works in all browsers, but I like Prototypes implementation of constructors and inheritance.
Finally, I increased the number of live starting cells, shrunk the number of boxes and increased the time delay between frames to hopefully grant a better user experience. It probably still looks terrible in Internet Explorer. Once again, that's what you get.
So check it out and download the code!
PS: You can still download and view the original version if you like.
Tags: game of life, javascript, prototype
I thought it would be fun to implement Conway's Game Of Life. I used ColdFusion a bit in my example to ease some typing but the "engine" is all JavaScript. Beloved Prototype is also being used a bit behind the scenes.
So without further ado, here's a
// set up a game of size 30 x 30 g = new Game_Of_Life(30); // set some random tiles, note that you // have way more of these for a size // 30 board. g.set_tile(2,26,1); g.set_tile(19,20,1); // draw inital board g.draw(); // run the game, 1/25s "frame-rate" g.run(.25);
And, as always: Download the code!
PS: It looks like terrible in Internet Explorer. No comment.
Tags: coldfusion, game of life, javascript, prototype