function search_test(arg)
max_cost = 100;
if arg == 0
    start = [1, 1];
    goal = [10, 10];
    map = rand(10,10) .* max_cost ;
    map = map+1;
elseif arg == 1
    start = [1, 1];
    goal = [10, 10];
    map = zeros(10,10);
    
    map(4,1:8) = max_cost;
    
    map(6,4:10) = max_cost;
    map = map+1;
elseif arg == 2
    start = [1, 1];
    goal = [80, 80];
    
    map = ones(100,100);      
    map(1:50,1:50) = ones(50,50);
    
    map(1:20,41:60) = random_map(20,20,20,7,max_cost);
    map(36:45,51:60) = random_map(10,10,20,10,max_cost);
    map(31:60,61:80) = random_map(30,20,15,10,max_cost);
    map(96:100,71:80) = random_map(5,10,15,10,max_cost);
    
    map = fill_map(map,11,70,91,100,max_cost/2);
    map = fill_map(map,25,30,27,50,max_cost/4);
    map = fill_map(map,25,30,5,26,max_cost/3);
    map = fill_map(map,49,51,53,56,max_cost);
    
    map = fill_map(map,10,11,1,45,max_cost);
    map = fill_map(map,10,11,50,95,max_cost);
    
    map = fill_map(map,20,21,5,90,max_cost);
    
    map(31:100,6:50) = random_map(70,45,9,7,max_cost); 
    map(61:84,56:64) = random_map(24,9,3,6,max_cost/3); 
    
    map = fill_map(map,20,95,5,6,max_cost);
    
    map = fill_map(map,50,51,5,10,max_cost);
    map = fill_map(map,50,51,15,20,max_cost);
    map = fill_map(map,50,51,25,30,max_cost);
    map = fill_map(map,50,51,35,40,max_cost);
    map = fill_map(map,50,51,45,50,max_cost); 
    map = fill_map(map,55,60,50,51,max_cost);
    map = fill_map(map,65,70,50,51,max_cost);
    map = fill_map(map,75,80,50,51,max_cost);
    map = fill_map(map,85,90,50,51,max_cost);
    map = fill_map(map,95,100,50,51,max_cost);
    
    map = fill_map(map,90,91,50,60,max_cost);
    map = fill_map(map,90,95,60,61,max_cost);
    
    map(71:95,66:100) = random_map(25,35,8,3,max_cost); 
    map = fill_map(map,76,85,76,85,max_cost/4);
    
    map = fill_map(map,80,81,50,55,max_cost);
    map = fill_map(map,80,85,55,56,max_cost);  
    map = fill_map(map,85,86,55,65,max_cost);
    map = fill_map(map,85,90,65,66,max_cost);
    map = fill_map(map,90,91,65,90,max_cost);
    map = fill_map(map,95,96,60,95,max_cost);
    map = fill_map(map,10,85,95,96,max_cost);
    map = fill_map(map,20,85,90,91,max_cost);   
    map = fill_map(map,25,50,26,27,max_cost);
    map = fill_map(map,40,41,18,38,max_cost);
    map = fill_map(map,30,50,49,50,max_cost);
    map = fill_map(map,30,31,35,50,max_cost);
    map = fill_map(map,45,46,5,20,max_cost);
    map = fill_map(map,25,26,27,50,max_cost);
    map = fill_map(map,30,31,50,55,max_cost);
    map = fill_map(map,25,31,55,56,max_cost);
    map = fill_map(map,25,26,55,85,max_cost);
    map = fill_map(map,25,70,85,86,max_cost);
    map = fill_map(map,55,56,50,60,max_cost);
    map = fill_map(map,30,56,59,60,max_cost);
    map = fill_map(map,30,31,60,80,max_cost);
    map = fill_map(map,30,70,80,81,max_cost);
    map = fill_map(map,65,66,50,55,max_cost);
    map = fill_map(map,60,66,55,56,max_cost);
    map = fill_map(map,60,61,55,65,max_cost);
    map = fill_map(map,60,80,65,66,max_cost);
    map = fill_map(map,65,78,55,56,max_cost);
    map = fill_map(map,67,79,54,55,max_cost/8);
    
    map = fill_map(map,67,68,52,54,max_cost/8);
    map = fill_map(map,69,70,52,54,max_cost/7);
    map = fill_map(map,71,72,52,54,max_cost/6);
    map = fill_map(map,73,74,52,54,max_cost/5);
    map = fill_map(map,75,76,52,54,max_cost/4);
    map = fill_map(map,77,79,52,54,max_cost/3);
    
    map = fill_map(map,92,100,52,60,max_cost/6);
    map = fill_map(map,35,60,65,66,max_cost);
    map = fill_map(map,65,85,60,61,max_cost);
    map = fill_map(map,95,100,95,100,max_cost/4);
    
    map = fill_map(map,72,73,40,51,max_cost/30);
    
    map = fill_map(map,60,70,28,29,max_cost/30);
    map = fill_map(map,22,33,10,11,max_cost/30);
    map = fill_map(map,32,33,10,24,max_cost/30);
    map = fill_map(map,32,39,23,24,max_cost/30);
    map = fill_map(map,32,49,48,49,max_cost/30);
    map = fill_map(map,27,39,28,29,max_cost/30);
    map = fill_map(map,27,28,30,50,max_cost/30);
    map = fill_map(map,60,61,10,27,max_cost/30);
    
    
    
    map = map+1;
elseif arg == 3
    
    start = [5, 5];
    goal = [95, 95];
    map = rand(100,100);  
    map = map_blur(map);
    map = map.^2;
    map = map_blur(map);
    map = map.^2;
    map = map_blur(map);
    map = map.^2;
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    
    
    map = normalise(map).* max_cost;
    map = map+1;
    
elseif arg == 4
    
    start = [5, 5];
    goal = [95, 95];
    map = rand(100,100).^9;  
    
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    
    map = normalise(map) .* max_cost; 
    
    map = fill_map(map,50,95,72,74,max_cost);
    
    
    map = fill_map(map,70,75,75,100,max_cost);
    
    
    map = fill_map(map,70,75,90,93,max_cost/3);
    
    map = fill_map(map,25,50,25,50,max_cost);
    map = fill_map(map,30,45,30,45,max_cost/3);
    
    
    map = fill_map(map,60,75,5,30,max_cost/2);
    
    
    map = fill_map(map,5,17,40,80,max_cost/2);
elseif arg == 5

    start = [5, 5];
    goal = [95, 95];
    map = rand(100,100).^30;  
    
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    
    map = normalise(map);
    map = map .* max_cost + 1;
elseif arg == 6
        
    start = [5, 5];
    goal = [95, 95];
    map = rand(100,100).^8;   
    
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = normalise(map) .* max_cost;
    
    map = fill_map(map,10,11,10,20,max_cost);
    
    map = fill_map(map,4,30,30,31,max_cost);
    
    map = fill_map(map,31,34,10,32,max_cost);
    
    map = fill_map(map,80,80,20,80,max_cost);
    
    map = fill_map(map,20,80,80,80,max_cost);
    
    %map = normalise(map);
    map(35:70,35:70) = normalise(map_blur(map_blur(map_blur(map_blur(map_blur(rand(36,36).^10)))))).* max_cost ;
    
    map = map + 1;
    
    map = fill_map(map,1,10,1,10,1);
    
    map = fill_map(map,50,100,10,15,max_cost/8);
    map = fill_map(map,95,100,10,85,max_cost/8);
    
    
    elseif arg == 7
        
    start = [5, 50];
    goal = [95, 50];
    map = rand(100,100).^30;  
    
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    
    map = normalise(map);
    map = map .* max_cost + 1;
 elseif arg == 8
        
    max_cost = 100;
    start = [5, 50];
    goal = [195, 50];
    map = rand(200,200).^3;  
    
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    map = map_blur(map);
    
    map = normalise(map);
    map = map .* max_cost + 1; 
    
    'here' 
end



map(start(1,2),start(1,1)) = 0;

map(goal(1,2),goal(1,1)) = 0;

q = 1:10;
clf

% baseline penn
tic
for q = 1:10
[x_path y_path] = astar(map,start,goal);
end
toc
draw_path(map,x_path, y_path,start,goal,'b');

% baseline work function
tic
for q = 1:10
    [x_path y_path] = work_astar(map,start,goal);
end
toc
hold on;
plot(x_path, y_path,'.','color','m');

% optimized penn with lethal detection
tic
for q = 1:10
    [x_path y_path] = simple_astar(map,start,goal);
end
toc
hold on;
plot(x_path, y_path,'color','g');

%optimized work function with lethal dectetion
tic
for q = 1:10
    [x_path y_path] = myastar(map,start,goal);
end
toc
hold on;
plot(x_path, y_path,'color','r');
