public override void Mutate(Random random, ExecutionEnvironment.Arr <int> field, int mutations)
        {
            for (int i = 0; i < mutations; i++)
            {
                int positionX = random.Next(0, field.W);
                int positionY = random.Next(0, field.H);

                int diffX = random.Next(0, 2) == 0 ? -1 : 1;
                if (positionX == 0)
                {
                    diffX = 1;
                }
                if (positionX == field.W - 1)
                {
                    diffX = -1;
                }

                int diffY = random.Next(0, 2) == 0 ? -1 : 1;
                if (positionY == 0)
                {
                    diffY = 1;
                }
                if (positionY == field.H - 1)
                {
                    diffY = -1;
                }

                field.Swap(field.Coords(positionX, positionY), field.Coords(positionX + diffX, positionY + diffY));
            }
        }
 public override void Mutate(Random random, ExecutionEnvironment.Arr <int> field, int mutations)
 {
     for (int i = 0; i < mutations; i++)
     {
         int positionX = random.Next(0, field.W);
         int positionY = random.Next(0, field.H);
         int direction = random.Next(0, 2) == 0 ? -1 : 1;
         if (random.Next(0, 2) == 0)
         { // horizontal
             if (positionX == 0)
             {
                 direction = 1;
             }
             if (positionX == field.W - 1)
             {
                 direction = -1;
             }
             field.Swap(field.Coords(positionX, positionY), field.Coords(positionX + direction, positionY));
         }
         else
         { // vertical
             if (positionY == 0)
             {
                 direction = 1;
             }
             if (positionY == field.H - 1)
             {
                 direction = -1;
             }
             field.Swap(field.Coords(positionX, positionY), field.Coords(positionX, positionY + direction));
         }
     }
 }