simple walk algorithm