Skip to content

Instantly share code, notes, and snippets.

View jasongorman's full-sized avatar

Jason Gorman jasongorman

View GitHub Profile
public class Fibonacci
{
public int[] GenerateFibonacciSequenceWithLength(int length)
{
int[] sequence = new int[length];
for (int i = 0; i < sequence.Length; i++)
{
sequence[i] = i < 2 ? i : sequence[i - 1] + sequence[i - 2];
}
return sequence;
def tick(cell, number_of_neighbors)
if number_of_neighbors < 2 || number_of_neighbors > 3
cell.setAlive false
end
if number_of_neighbors == 3
cell.setAlive true
end
end