Simple game in ruby/javascript