



Algorithm Pseudo Code
---------------------
Input: Gameboard matrix of width W and height H
Output: Solution matrix of width W and height H
for Gameboard[i,j] = 1:
initialize fringe with(i,j)
for p in range(4):
if fringe is empty:
break
else:
clear priority queue
for node in fringe:
estimates a value for constraintness of node
add to priority queue according to value
remove node at front of priority queue and delete from fringe
add to placed pieces list
update game board location(i,j)node
for(i,j)to Above, Right, Below, Left of node:
if(i,j)'s direction is 1 and not in previously visited nodes:
add(i,j)'s direction to fringe
if four pieces placed:
set piece location on Solution as (shape id, piece id)
return Solution