% This snake program makes use of sparse linear solver
% a simple trick leading to some approximation is used to reduce the bandwidth
% of the coefficient matrix to only a tridiagonal one
close all;
clear all;
clc;
h=256;
w=256;
I = zeros(h,w);
I(round(h/2),round(w/2))=1;
I = double(bwdist(I)