function [A,bact,mult] = determine_movement_alt(A,bact,mult)
  
           global energy maxX maxY destroyed;
           phyto = .4;
           bacterium = .6;
           multi = 1.0;
           movement_chance = .95;
           size1 = size(bact);
           size1 = size1(1); 
       
          
           for i =1:size1
               r = rand();
               x = bact(i,1);
               y = bact(i,2);
               if(A(x,y) == 0)
                   
                   continue;
               end
               if(x>maxX)
                    x = 1;
                end
                if(x<1)
                    x = maxX;
                end
                if(y==0)
                    y = 1;
                end


                xR = x+1; % xRIGHT = x coordinate of my right neighbor
                xL = x-1; % xLEFT  = x coordinate of my left  neighbor
                yU = y+1; % yUP    = y coordinate of my upper neighor
                yD = y-1; % yDOWN  = y coordinate of my lower neighbo

                %%% Now apply periodic boundary conditions to xL and xR
                if(xR>maxX)
                    xR = 1;
                end

                if(xL<1)
                    xL = maxX;
                end
                if (yD == 0)
                    yD = 1;
                end
                if(yU>maxY)
                    continue;
                end
               
                  if (r < movement_chance)
                      if(A(xR,y) == phyto || (A(xR,y) == 0 && (r< movement_chance/4)))
                          if (A(xR,y) == phyto)
                              energy = energy + 1;
                          end
                          A(x,y) = 0;
                          A(xR,y) = bacterium;
                          bact(i,1) = xR;
                         
                     
                  elseif(A(xL,y) == phyto || (A(xL,y) == 0 && (r< movement_chance/2)))
                          if (A(xL,y) == phyto)
                              energy = energy + 1;
                          end
                          A(x,y) = 0;
                          A(xL,y) = bacterium;
                          bact(i,1) = xL;
                  elseif(A(x,yU) == phyto || (A(x,yU) == 0 && (r< movement_chance/1.33)))
                          if (A(x,yU) == phyto)
                              energy = energy + 1;
                          end
                          A(x,y) = 0;
                          A(x,yU) = bacterium;
                          bact(i,2) = yU;
                  elseif(A(x,yD) == phyto || A(x,yD) == 0)
                          if (A(x,yD) == phyto)
                              energy = energy + 1;
                          end
                          A(x,y) = 0;
                          A(x,yD) = bacterium;
                          bact(i,2) = yD;
                      end
                  end
                  if(mod(energy, 30)==0)

                      A(x,y) = bacterium;
                      bact = [bact; x,y];
                      energy = 1;
                  end
                  
           end

           size2 = size(mult);
           size2 = size2(1); 
             for i =1:size2
               r = rand();
               x = mult(i,1);
               y = mult(i,2);
               if(x>maxX)
                    x = 1;
                end
                if(x<1)
                    x = maxX;
                end
          
                if(y==0)
                    y = 1;
                end


                xR = x+1; % xRIGHT = x coordinate of my right neighbor
                xL = x-1; % xLEFT  = x coordinate of my left  neighbor
                yU = y+1; % yUP    = y coordinate of my upper neighor
                yD = y-1; % yDOWN  = y coordinate of my lower neighbo

                %%% Now apply periodic boundary conditions to xL and xR
                if(xR>maxX)
                    xR = 1;
                end

                if(xL<1)
                    xL = maxX;
                end
                if (yD == 0)
                    yD = 1;
                end
                  if(yU>maxY)
                    continue;
                end
               
             
                   if (r < movement_chance)
                      if(A(xR,y) == bacterium || (A(xR,y) == 0 && (r< movement_chance/4)))
                          if (A(xR,y) == bacterium)
                              destroyed = destroyed + 1;
                          end
                          A(x,y) = 0;
                          A(xR,y) = multi;
                          mult(i,1) = xR;
                  elseif(A(xL,y) == bacterium|| (A(xL,y) == 0 && (r< movement_chance/2)))
                          if (A(xL,y) == bacterium)
                              destroyed = destroyed + 1;
                          end
                          A(x,y) = 0;
                          A(xL,y) = multi;
                          mult(i,1) = xL;
                  elseif(A(x,yU) == bacterium|| (A(x,yU) == 0 && (r< movement_chance/1.33)))
                          if (A(x,yU) == bacterium)
                              destroyed = destroyed + 1;
                          end
                          A(x,y) = 0;
                          A(x,yU) = multi;
                          mult(i,2) = yU;
                  elseif(A(x,yD) == bacterium || A(x,yD) == 0)
                          if (A(x,yD) == bacterium)
                              destroyed = destroyed + 1;
                          end
                          A(x,y) = 0;
                          A(x,yD) = multi;
                          mult(i,2) = yD;
                      end
                  end
             end
           destroyed
           
 
      
           
        
    
                