rescuing colored balls from obstacles