Agriculture

# Technological Crisis at Shikakuro Farms

Nikoli the Farmer has decided to remodel his two 9×9 livestock pens, but something unfortunate has happened. His high-tech Troughmaster automated feeding systems have been accidentally pre-installed at various locations from which he cannot move them. Therefore he must instead find a way to put animals in the stalls leaving the Troughmasters where they are. The systems work as follows:
1. The location of each Troughmaster is shown by a number in the grid, indicating the number of animals that machine can feed.
2. Each of the two pens must be partitioned into a number of rectangular enclosures, in such a way that each enclosure contains exactly one Troughmaster, and exactly the number of animals the Troughmaster requires.
3. Each of the 81 stalls in the grid (including the ones where the Troughmasters are located) must contain some integer number of animals between 1 and 9.
4. Each row and column of each grid must include stalls with all nine different numbers of animals. (Shikakuro Farm was formerly known as Sudoku Farm before Farmer Nikoli diversified his production.)
5. Within each rectangular enclosure, no two stalls may contain the same number of animals.
6. Indeed, within a given enclosure, no two adjacent stalls may even contain consecutive numbers of animals (or else the two groups of animals may quarrel with each other). For instance, if one stall has 5 animals in it, no horizontally or vertically adjacent stall within the same enclosure may contain exactly 4 or exactly 6 animals.
In fact, this quarreling problem has become so great that even if two adjacent stalls in different enclosures (i.e., with an enclosure wall between them) contain consecutive numbers of animals, the enclosure wall between those two stalls needs to be reinforced.

See below for a sample grid and its solution.

 Sample puzzle grid: Solution to sample puzzle:
Note the following properties of the solution:
1. The Latin-square constraint is satisfied: each digit appears exactly once in each row and column.
2. Each enclosure in the solution grid contains (the location of) exactly one of the clue numbers in the puzzle grid.
3. No digit appears more than once in any enclosure.
4. The sum of the digits in any enclosure in the solution is equal to the corresponding clue number.
5. Two consecutive digits within the same enclosure are never horizontally or vertically adjacent to each other (but consecutive digits may be adjacent on opposite sides of an enclosure wall).