(1) if    then
(2) return
(3) else
(4) for each action plan of the th unit
(5)  execute the current plan
(6)  call  
(7)  cancel this plan and rollback to the previous state
(8) end for
(9) end if
Algorithm 3: Search(i).