Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I would argue that dodgeball is better expressed as an iterative algorithm. Consider the following pseudocode:

  def dodgeball(players, balls)
    until players.all? { |p| p.is_hit? }
      throw(nearest_ball(balls), nearest_player(players))
    end
  end
Most people think like this. Dodgeball teaches while loops, not recursion.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: