Skip to content

Instantly share code, notes, and snippets.

View timriffe's full-sized avatar

Tim Riffe timriffe

View GitHub Profile
@timriffe
timriffe / life2.r
Created February 24, 2012 09:50 — forked from vvinichenko/life.r
Game of Life in R (abdridged)
# Game of Life, by Vadim Vinichenko https://github.com/vvinichenko
# I've pasted his 2 functions here with no experiment at the bottom in order to be able to source this code
# straight from R like this:
# source("http://raw.github.com/gist/1899814/881e5f92c9413a5e1800c8a274d177982d796a8c/life2.r")
# that line loads the 2 functions automatically. Experiment Gist to follow
shiftMatrix <- function(mx, dr, dc) {
#Shift the matrix by dr (delta r) rows and dc columns
#by adding e.g. dr rows of zeros and removing dr rows from the other side