Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (488)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Conway's Game of Life! 1.2  (Read 4494 times)
0 Members and 1 Guest are viewing this topic.
Offline samdeman22

Junior Member


Projects: 1



« Posted 2013-09-23 18:40:14 »

After I saw Conway's game of life on Dara Ó Briain's maths club, I knew then and there that that would be good for my first solo program. After a bit of help with my malfunctioning code from some VERY kind people...
here: http://www.java-gaming.org/topics/an-array-index-out-of-bounds-exception-i-know-what-that-means-but-why/30036/msg/278077/view.html#msg278077

I made...



THE GAME OF LIFE:
Conway's game of life is a game that consists of an orthographic grid of cells that can be "alive" or "dead"; it is built on 4 simple rules:
/*
    *Live cells with fewer than two live neighbours die.
    *Live cells with two or three neighbours live on.
    *Live cells with more than three neighbours die.
    *Dead cells with two or three live neighbours become live.
*/

it can be quite fun to build contraptions (or societies if you like..) of your own, but one problem with this version is that the window is relatively tiny and there is no option to move the viewing pane. (I could change that but it would take a lot of effort on my part XD)

DOWNLOADS:

1.2 (i.e. adds optional game speeds and cell set up instead of initializing the cells from code)
here: http://www.mediafire.com/download/4ro1aja74tgkics/game_of_life_1_2.zip

CONTROLS:
- use the mouse and left click to turn on/ turn off a cell.
- change the game speed (BEFORE activating) using shift/control
- use enter to activate and watch your simulation.

TESTING:
- if anyone can be bothered, test a glider http://www.google.co.uk/imgres?imgurl=http://upload.wikimedia.org/wikipedia/en/d/d0/Game_of_life_animated_glider_2.gif&imgrefurl=http://en.wikipedia.org/wiki/Wikipedia:Featured_picture_candidates/Game_of_Life_glider&h=336&w=336&sz=44&tbnid=0KHI2rB7-nhTeM:&tbnh=91&tbnw=91&zoom=1&usg=__znNp1_Tq1OWAyAAgC3Ba5vCYPQk=&docid=UttFrzpPxFTobM&sa=X&ei=DYtAUtzoIsG50QWhzYGYCA&ved=0CEsQ9QEwBA for long enough that it could have exited the map (around 229 cells away) I would be very greatful. If nothing breaks GREAT! if it does however, post up the error message (if there is one?).

If in doubt go flat out - Collin McRae
Offline samdeman22

Junior Member


Projects: 1



« Reply #1 - Posted 2013-09-23 18:49:27 »

forgot about a picture XD, got it now!

If in doubt go flat out - Collin McRae
Offline sproingie

JGO Kernel


Medals: 202



« Reply #2 - Posted 2013-09-24 18:41:45 »

The rules for Life can actually be expressed more simply:

A live cell with two neighbors stays live.
A live or dead cell with three neighbors is live.
All other cells are dead.

This turns into a one-liner (where a cell is a boolean):
cell = neighbors == 3 || cell && (neighbors == 2);






Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline samdeman22

Junior Member


Projects: 1



« Reply #3 - Posted 2013-09-24 19:07:36 »

The rules for Life can actually be expressed more simply:

A live cell with two neighbors stays live.
A live or dead cell with three neighbors is live.
All other cells are dead.

This turns into a one-liner (where a cell is a boolean):
cell = neighbors == 3 || cell && (neighbors == 2);



I know, I found that out when coding, but the rules on the wiki, i.e the rules that would be explained to a player, are in the main post ^

If in doubt go flat out - Collin McRae
Offline samdeman22

Junior Member


Projects: 1



« Reply #4 - Posted 2013-09-24 19:15:04 »

The rules for Life can actually be expressed more simply:

A live cell with two neighbors stays live.
A live or dead cell with three neighbors is live.
All other cells are dead.

This turns into a one-liner (where a cell is a boolean):
cell = neighbors == 3 || cell && (neighbors == 2);








hmm that's probably simpler to explain to a player too though... XD

If in doubt go flat out - Collin McRae
Offline pjt33
« Reply #5 - Posted 2013-09-24 20:18:24 »

The rules for Life can actually be expressed more simply:
A cell is live in the next generation if there are exactly three cells either in its open Moore neighbourhood or in its closed Moore neighbourhood.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #6 - Posted 2013-09-25 20:28:10 »

Well sure, if you go with CA jargon, you could just say "B3/S23"

Pages: [1]
  ignore  |  Print  
 
 

 
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!