function diagonal(game,n1,n2)
[i1,j1]=getindex(n1);
[i2,j2]=getindex(n2);
 if i1==i2-1 && j1==j2-1
             if sumn(game,1:i1,j1)==sumn(game,1:i2,j2)
                 move(game,'up');
                 move(game,'left');
             else if sumn(game,i1:4,j1)==sumn(game,i2:4,j2)
                 move(game,'down');
                 move(game,'left');
                 else if sumn(game,i1,1:j1)==sumn(game,i2,1:j2)
                 move(game,'left');
                 move(game,'up');
                     else if sumn(game,i1,j1:4)==sumn(game,i2,j2:4)
                 move(game,'right');
                 move(game,'up');
                          end                 
                     end
                 end
             end
 end
 
 if i1==i2-1 && j1==j2+1
            if sumn(game,1:i1,j1)==sumn(game,1:i2,j2)
                 move(game,'up');
                 move(game,'right');
             else if sumn(game,i1:4,j1)==sumn(game,i2:4,j2)
                 move(game,'down');
                 move(game,'right');
                 else if sumn(game,i1,1:j1)==sumn(game,i2,1:j2)
                 move(game,'left');
                 move(game,'up');
                     else if sumn(game,i1,j1:4)==sumn(game,i2,j2:4)
                 move(game,'right');
                 move(game,'up');
                          end                 
                     end
                 end
            end
 end
        
 if i1==i2+1 && j1==j2-1
             if sumn(game,1:i1,j1)==sumn(game,1:i2,j2)
                 move(game,'up');
                 move(game,'left');
             else if sumn(game,i1:4,j1)==sumn(game,i2:4,j2)
                 move(game,'down');
                 move(game,'left');
                 else if sumn(game,i1,1:j1)==sumn(game,i2,1:j2)
                 move(game,'left');
                 move(game,'down');
                     else if sumn(game,i1,j1:4)==sumn(game,i2,j2:4)
                 move(game,'right');
                 move(game,'down');
                          end                 
                     end
                 end
             end
 end
        
 if i1==i2+1 && j1==j2+1
             if sumn(game,1:i1,j1)==sumn(game,1:i2,j2)
                 move(game,'up');
                 move(game,'right');
             else if sumn(game,i1:4,j1)==sumn(game,i2:4,j2)
                 move(game,'down');
                 move(game,'right');
                 else if sumn(game,i1,1:j1)==sumn(game,i2,1:j2)
                 move(game,'left');
                 move(game,'down');
                     else if sumn(game,i1,j1:4)==sumn(game,i2,j2:4)
                 move(game,'right');
                 move(game,'down');
                          end                 
                     end
                 end
             end
 end