* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: Game of Lyfe  (Read 554 times)

0 Members and 1 Guest are viewing this topic.

Offline semiprocoder

  • Full User
  • Join Date: May 2015
  • Location:
  • Posts: 282
  • Post Rating Ratio: +2/-0
    • awesommee333
    • 114/11470
    • View Profile
  • Gender: Male
Game of Lyfe
« on: February 17, 2017, 01:55:18 am »
So I kind of lost interest in programming for a while, but I can say that, at least for now, I am back(maybe?).
Anyways, I decided to make Conway's Game of Life, but with some modifications. So I originally meant to create a two player game in which each player either would try to snuff out the other or have more of "their own" cells or something along those lines after a certain time limit. However, I have completely changed my direction(might still try making a two player game) when I started to mess around with the physics of game of life.
If you don't know how the game works, I will just quote Wikipedia, as I am bad at explaining things:
Quote
The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead, or "populated" or "unpopulated" (the difference may seem minor, except when viewing it as an early model of human/urban behaviour simulation or how one views a blank space on a grid). Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:
Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.
Any live cell with two or three live neighbours lives on to the next generation.
Any live cell with more than three live neighbours dies, as if by overpopulation.
Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed—births and deaths occur simultaneously, and the discrete moment at which this happens is sometimes called a tick (in other words, each generation is a pure function of the preceding one). The rules continue to be applied repeatedly to create further generations.

So, as I said, I decided to mess around with the rules a little bit. I decided to change the amount of living cells required to create a living cell, and I decided to change the amount of cells that a living cell can live with. Then I decided to add some color. The color is added by checking how many alive cells are near the cell BEFORE reproduction. I know this is weird, as it means that it is kind of outdated, and I am not sure whether adding color after reproduction will look better, but I am lazy to do that :P.

Anyways, the two attachments show the initial configuration for a system where the a cell can spawn if there are exactly 2 living cells next to it, and a cell can die if there are less than 2 or more that 6 living cells beside it. The color scheme is inverted to what I've generally seen, with dead cells being black, but I think this looks better. The initial configuration does have red lines, which signify walls, but I disabled walls for this game, so imagine them as nonexistent.

EDIT: I think this looks cool, despite a lot of quality being lost after conversions(obs record to mp4, then to mpeg in ffmpeg, then to gif in virtualdub): http://gph.is/2kYk3k3. This was done with the same + configuration, but cells come alive if there are 2-6 adjacent cells, and, as before, they stay alive with 2-6 adjacent cells.

SECOND EDIT: Added some more pictures that I think look pretty cool.
« Last Edit: February 17, 2017, 06:56:03 pm by semiprocoder »


  • Calculators owned: ti nspire, ti 84 plus se
My cemetech username is awesommee333.

Offline alexgt

  • Just your friendly neighborhood Ninja Stach Fancy Iron Man
  • Super User
  • Join Date: Dec 2014
  • Location: Behind you
  • Posts: 2610
  • Post Rating Ratio: +6/-1
  • Something should go here...
    • /u/alexgt9123
    • View Profile
  • Gender: Male
Re: Game of Lyfe
« Reply #1 on: February 17, 2017, 01:57:16 am »
Nice work! I made a Conway game for the prime but it was slow due to a bad algorithm xD
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Offline semiprocoder

  • Full User
  • Join Date: May 2015
  • Location:
  • Posts: 282
  • Post Rating Ratio: +2/-0
    • awesommee333
    • 114/11470
    • View Profile
  • Gender: Male
Re: Game of Lyfe
« Reply #2 on: February 17, 2017, 02:48:44 am »
@alexgt what did you do? My code is pretty slow at resolutions of 800x800 cells. I rendered the shown images at 399x399, and the framerate is probably like 10-20. Still ok, but not super smooth.
  • Calculators owned: ti nspire, ti 84 plus se
My cemetech username is awesommee333.

Offline alexgt

  • Just your friendly neighborhood Ninja Stach Fancy Iron Man
  • Super User
  • Join Date: Dec 2014
  • Location: Behind you
  • Posts: 2610
  • Post Rating Ratio: +6/-1
  • Something should go here...
    • /u/alexgt9123
    • View Profile
  • Gender: Male
Re: Game of Lyfe
« Reply #3 on: February 17, 2017, 04:06:45 am »
well, if I remember right, I used two matrices and had the first be the base (1st generation), and I iterated through the first matrix, checking every index with the 8 adjacent squares and determining if it should live or die and then storing that to the same index on the 2nd matrix, alive or dead (1 or 0), and then finally setting the 1st matrix equal to the 2nd, clearing the second and repeat. I haven't come up with anything as simple that works faster (I haven't given it much though tbh tho) so I think you would have to make a pretty complicated algorithm to accomplish it faster, I will give it some thought though ;). Good luck!
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Offline semiprocoder

  • Full User
  • Join Date: May 2015
  • Location:
  • Posts: 282
  • Post Rating Ratio: +2/-0
    • awesommee333
    • 114/11470
    • View Profile
  • Gender: Male
Re: Game of Lyfe
« Reply #4 on: February 17, 2017, 04:02:24 pm »
That's essentially what I do, except I also record the number alive so I can set the colors for each square. Also I record state and playerState, but that is unimportant for my current program right now; I plan to use state, although playerState is only going to be used for a two player game.

Also I have decided to export my code as a java file, attached below. Just unzip the file, and it should have a settings folder and a jar. No readme yet, cause I am lazy, but one will probably be made soon. I do have some notes in the settings.txt file though, so that should help you.

And here is the source(yeah ik I could do something with github but I havent used it for so long and I don't feel like spending time learning how it works again):
https://github.com/awesommee333/LYFE/blob/master/LYFE-SOURCE.zip

EDIT: I think I may have uploaded an outdated version that didn't work, so I just reuploaded the LYFE.zip attachment.
« Last Edit: February 17, 2017, 05:31:33 pm by semiprocoder »
  • Calculators owned: ti nspire, ti 84 plus se
My cemetech username is awesommee333.

Offline Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3150
  • Post Rating Ratio: +31/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • View Profile
    • quantuminfinity
  • Gender: Male
Re: Game of Lyfe
« Reply #5 on: February 17, 2017, 04:15:58 pm »
Processing eh? You can put it online at openprocessing.org and send us the link :)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline semiprocoder

  • Full User
  • Join Date: May 2015
  • Location:
  • Posts: 282
  • Post Rating Ratio: +2/-0
    • awesommee333
    • 114/11470
    • View Profile
  • Gender: Male
Re: Game of Lyfe
« Reply #6 on: February 17, 2017, 04:39:33 pm »
@Snektron Well its not so simple. I have it running in eclipse, with java classes, so I can't really port it over to javascript, especially as I don't know javascript.
  • Calculators owned: ti nspire, ti 84 plus se
My cemetech username is awesommee333.

Offline Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3150
  • Post Rating Ratio: +31/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • View Profile
    • quantuminfinity
  • Gender: Male
Re: Game of Lyfe
« Reply #7 on: February 17, 2017, 04:47:48 pm »
Isnt processingjs the same syntax? (I haven't done processing in a while so i wouldnt know)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Online DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 17822
  • Post Rating Ratio: +89/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: Game of Lyfe
« Reply #8 on: February 17, 2017, 05:20:28 pm »
This looks fun to mess around with, judging by how cool the generated pictures look like. :)

I'm gonna download this when I'm home
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)
??? ??? ??? ???

Offline semiprocoder

  • Full User
  • Join Date: May 2015
  • Location:
  • Posts: 282
  • Post Rating Ratio: +2/-0
    • awesommee333
    • 114/11470
    • View Profile
  • Gender: Male
Re: Game of Lyfe
« Reply #9 on: February 17, 2017, 06:08:23 pm »
@DJ Omnimaga Tell me what you come up with! I haven't spent much time with this myself, but I already think that I've generated some cool images, despite really just learning about conway's game of life. I am going to try a black and white walrii as the initial configuration and see what it generates.

EDIT: Nothing too cool with a walrii :(.
« Last Edit: February 17, 2017, 06:19:02 pm by semiprocoder »
  • Calculators owned: ti nspire, ti 84 plus se
My cemetech username is awesommee333.

Online DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 17822
  • Post Rating Ratio: +89/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: Game of Lyfe
« Reply #10 on: February 18, 2017, 07:42:21 pm »
Yeah my idea was to try with a Walrii but only if I could import one since it would take a while to draw while I'm busy :P. But I might try with a few of my older sprites.
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)
??? ??? ??? ???

Offline alexgt

  • Just your friendly neighborhood Ninja Stach Fancy Iron Man
  • Super User
  • Join Date: Dec 2014
  • Location: Behind you
  • Posts: 2610
  • Post Rating Ratio: +6/-1
  • Something should go here...
    • /u/alexgt9123
    • View Profile
  • Gender: Male
Re: Game of Lyfe
« Reply #11 on: February 21, 2017, 05:16:02 am »
Nice progress, I how the multi player turns out well ;).
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games