Jun 27, 2009

Conway's Game of Life on your iPhone

You can try Conway's Game of Life on your iPhone.
It's some kind of artificial life simulation.

Life for iPhone (iTunes)







Life for iPhone (iTunes)

You will be able to keep seeing its mysterious pattern.

Jun 16, 2009

Fibonacci in Ruby

a method for Fibonacci number:

def fib(n)
if n < 2
1
else
fib(n - 2) + fib(n - 1)
end
end


result:

puts fib(10) #=> 89

Jun 12, 2009

I came back!

I'll write in this blog again.


class Programmer
def says(message)
puts message
end
end

shunsuk = Programmer.new
shunsuk.says "I came back!"

Nov 16, 2008

I Moved this blog

I move into WordPress from Blogger.

Protean [Henggen-Zizhai]

Nov 14, 2008

Difference between "do end" and "{ }" in Ruby

"{ }" has a stronger connection than "do end".


def foobar a, b
if block_given?
yield a, b
else
puts a * b
end
end



foobar is called with block.


foobar 2, 3 do |a, b|
puts a + b #=> 5
end



b is called with block.


def b
yield
end

foobar 2, b { 3 } #=> 6

Nov 13, 2008

Birthday Party

Today is my niece's birthday.
We're going to meet her.

Nov 12, 2008

Great Help of Vim

Type ":help!" when you get panick.