This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write a system that evolves a 100 x 100 grid of cells | |
to the next generation according to the following rules. | |
1) Any living cell with less than 2 live neighbors dies | |
2) Any living cell with 2 or 3 live neighbors stays alive | |
3) Any living cell with more than 3 live neighbors dies | |
4) Any dead cell with exactly 3 lives neighbors comes to life | |
Note: A cell has 8 neighbors | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby-1.9.2-p180 :001 > bunny = bunny = { bunny => bunny } | |
=> {nil=>nil} | |
ruby-1.9.2-p180 :002 > bunny = bunny = { bunny => bunny } | |
=> {{nil=>nil}=>{nil=>nil}} | |
ruby-1.9.2-p180 :003 > bunny = bunny = { bunny => bunny } | |
=> {{{nil=>nil}=>{nil=>nil}}=>{{nil=>nil}=>{nil=>nil}}} | |
ruby-1.9.2-p180 :004 > bunny = bunny = { bunny => bunny } | |
=> {{{{nil=>nil}=>{nil=>nil}}=>{{nil=>nil}=>{nil=>nil}}}=>{{{nil=>nil}=>{nil=>nil}}=>{{nil=>nil}=>{nil=>nil}}}} | |
ruby-1.9.2-p180 :005 > bunny = bunny = { bunny => bunny } | |
=> {{{{{nil=>nil}=>{nil=>nil}}=>{{nil=>nil}=>{nil=>nil}}}=>{{{nil=>nil}=>{nil=>nil}}=>{{nil=>nil}=>{nil=>nil}}}}=>{{{{nil=>nil}=>{nil=>nil}}=>{{nil=>nil}=>{nil=>nil}}}=>{{{nil=>nil}=>{nil=>nil}}=>{{nil=>nil}=>{nil=>nil}}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
begin | |
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME'])) | |
rvm_lib_path = File.join(rvm_path, 'lib') | |
$LOAD_PATH.unshift rvm_lib_path | |
require 'rvm' | |
RVM.use_from_path! File.dirname(File.dirname(__FILE__)) | |
rescue LoadError | |
raise "RVM ruby lib is currently unavailable." | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def self.toy(n=10, &block) | |
block_given? ? Array.new(n,&block) : Array.new(n) {|i| i+1} | |
end | |
end | |
class Hash | |
def self.toy(n=10) | |
Hash[Array.toy(n).zip(Array.toy(n){|c| (96+(c+1)).chr})] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Guide | |
# Configure the essential configurations below and do the following: | |
# | |
# Repository Creation: | |
# cap deploy:repository:create | |
# git add . | |
# git commit -am "initial commit" | |
# git push origin master | |
# | |
# Initial Deployment: |