I am playing with a set of blocks where I need to arrange the blocks into stacks. Here are the actions I can do

Pick up a block
Unstack a block from on top of another block
Put down a block
Stack a block on top of another block

I have the following restrictions on my actions:
I can only pick up or unstack one block at a time.
I can only pick up or unstack a block if my hand is empty.
I can only pick up a block if the block is on the table and the block is clear. A block is clear if the block has no other blocks on top of it and if the block is not picked up.
I can only unstack a block from on top of another block if the block I am unstacking was really on top of the other block.
I can only unstack a block from on top of another block if the block I am unstacking is clear.
Once I pick up or unstack a block, I am holding the block.
I can only put down a block that I am holding.
I can only stack a block on top of another block if I am holding the block being stacked.
I can only stack a block on top of another block if the block onto which I am stacking the block is clear.
Once I put down or stack a block, my hand becomes empty.

After being given a goal statement and a state, give the number of subgoals achieved after "[SUBGOALS ACHIEVED]".

[GOAL] My goal is to have that the orange block is on top of the red block and the yellow block is on top of the blue block.
[STATE] I have that, the blue block is clear, the orange block is clear, the hand is empty, the blue block is on top of the yellow block, the orange block is on top of the red block, the yellow block is on the table and the red block is on the table.
[SUBGOALS ACHIEVED] 1

[GOAL] My goal is to have that the blue block is on top of the yellow block and the orange block is on top of the red block.
[STATE] I have that, the red block is clear, the blue block is clear, the orange block is clear, the hand is empty, the orange block is on top of the yellow block, the red block is on the table, the blue block is on the table and the yellow block is on the table.
[SUBGOALS ACHIEVED] 0

[GOAL] My goal is to have that the blue block is on top of the yellow block and the yellow block is on top of the orange block.
[STATE] I have that, the blue block is clear, the hand is empty, the blue block is on top of the yellow block, the yellow block is on top of the orange block, the orange block is on the table, and the red block is on the table.
[SUBGOALS ACHIEVED] 2

[GOAL] {}
[STATE] {}
[SUBGOALS ACHIEVED] 