﻿Start by creating an outer wall box (4 walls)

for each row except the last one
	wallDrawingStartsAt = -1;
	for each column in row
		if this wall-ness is different from the next row down's wall-ness
			if wallDrawingStartsAt == -1
				wallDrawingStartsAt = this column
		else
			if wallDrawingStartsAt != -1
				add a new wall from the bottom left of wallDrawingStartsAt to the bottom left of this cell
				wallDrawingStartsAt = -1
	//close off a wall if you're drawing one
	if wallDrawingStartsAt != -1
		add a new wall from the bottom left of wallDrawingStartsAt to the bottom left of this cell
		wallDrawingStartsAt = -1

for each column except the last one
	wallDrawingStartsAt = -1;
	for each row in column
		if this's wall-ness is different from the next column over's wall-ness
			if wallDrawingStartsAt == -1
				wallDrawingStartsAt = this row
		else
			if wallDrawingStartsAt != -1
				add a new wall from the top right of wallDrawingStartsAt to the top right of this cell
				wallDrawingStartsAt = -1
	//close off a wall if you're drawing one
	if wallDrawingStartsAt != -1
		add a new wall from the top right of wallDrawingStartsAt to the top right of this cell
		wallDrawingStartsAt = -1
