Thinker: Learning to Plan and Act