BEGIN
 

Create a Plan-Queue of plans.

Initialize Plan-Queue to empty.

Insert the empty-plan into the end of the Plan-Queue.

Get an initial  state "S-init" and goal state "S-goal" from user.

Set boolean "solved" to False.

While(not solved)

   {

         Remove a plan from the front of the Plan-Queue, call it plan P.
         Run plan P on the initial state S-init to get a final state "S-final"
         If S-final == S-goal
                  then  solved = True
                  else   If ( legal_state (S_final) )
                                     then  {
                                                   generate all possible children of P
                                                   by generating all possible one step extensions of P
                                                   (for each possible operator)
                                                   add each child plan to the end of Plan-Queue
                                                }
       }

Output plan P to user
 

END