Skip to content

Instantly share code, notes, and snippets.

View mfpiccolo's full-sized avatar

Mike Piccolo mfpiccolo

View GitHub Profile
@mfpiccolo
mfpiccolo / fibonacci_array.rb
Last active December 11, 2015 16:59
Returns the corresponding number from the fibonacci sequence
class Integer
def fibonicci
a = 0
b = 1
if self == 1
1
elsif self == 0
0
elsif self > 1
array1 = [0,1]
@mfpiccolo
mfpiccolo / dictionary.rb
Created January 25, 2013 07:20
Create a new Dictionary with Dictionary.new. Then you can fill it with words and their corresponding definitions with the .new_words method. Put them in alphabetical order with .alpha and search the dictionary with .search. Create a new dictionary with .new_hash method.
class Dictionary
attr_accessor :new_hash
def initialize
empty_hash = Hash.new
@empty_hash = empty_hash
end
def new_words(new_hash)
dictionary1 = @empty_hash.merge(new_hash)
@mfpiccolo
mfpiccolo / yacht_hand.rb
Created February 19, 2013 05:40
Finds what hand you have in yachtzee.
class Yach_hand
attr_reader :array
def initialize(array)
@array = array
end
def read_hand
if yacht?
"Thats a yachtzee"
@mfpiccolo
mfpiccolo / game_of_life.rb
Created February 22, 2013 04:36
The game of life
class LifeGrid
def initialize(width, height, seeds)
matrix = Array.new(height).fill(0..(height - 1))
@matrix = matrix
new_matrix = @matrix
@new_matrix = new_matrix
@height = height
@mfpiccolo
mfpiccolo / welkrj
Created March 18, 2013 17:14
sldfj
sldkjf
@mfpiccolo
mfpiccolo / sample gist
Created March 18, 2013 17:42
sample gist
sample code
@mfpiccolo
mfpiccolo / sample1
Created March 18, 2013 17:43
sample1
sample1
@mfpiccolo
mfpiccolo / welkrj
Created March 18, 2013 17:44
lskdwerj
lwekjr
@mfpiccolo
mfpiccolo / lsdkjf
Created March 18, 2013 17:45
ljewr
clvjk
@mfpiccolo
mfpiccolo / lkvcjl
Created March 18, 2013 17:46
laekjrlw
cvxljk