 A method exists that uses essentially no memory for four-connected regions by pretending to be a painter trying to paint the region without painting themselves into a corner.This is also a method for solving mazes.The four pixels making the primary boundary are examined to see what action should be taken.