Will cows win always if both play optimally?

88 Views Asked by At

There is a green rectangular grid of size $n \times m$ with $k$ cows in it.

The objective of the cow is to escape the field. If any one of the cows escape, all cows are set free.

There is a farmer who tries to restrict the field by putting up fences along the border. Initially the grid is not fenced.

Cows coordinate and think of a plan to escape. Cows get the first move. Cows and farmer move alternatively. At any move any one of the $k$ cows can move to their neighboring cell (the cell that shares an edge with it). If the cow is already at the edge of the field and the edge is not fenced then it can escape it and hence all cows are set free. After every move of the cows the farmer can fence some edge at the border of the field of length $1$ so that no cow is able to escape from that edge anymore.

We are given the initial coordinates of the cows and the size of the grid.

Now, no matter how I make a grid, are the cows able to escape always if both play optimally? Will there be a case when cows cannot escape?

How can we say that a cow can escape or not given a coordinate $(x,y)$?

1

There are 1 best solutions below

0
On BEST ANSWER

The farmer can always win as long as all the cows start sufficiently far from the border (specifically, far enough that it takes them more than $4$ moves to reach the border). For the first four turns, the farmer should fence off one of the edges of each corner square of the grid. Thereafter, if it's the farmer's turn and there is a cow that is threatening to escape, the farmer should build a fence to block it. Note that (by induction on turns) there can be only one cow threatening to escape on any given turn (since after the farmer's last turn there were none, and only one of the cows moved since then). And since the four corner squares each have one of their exits fenced already, there is only edge by which the cow can be threatening to escape and which needs to be fenced.

Conversely, if a cow starts close enough to the border to reach it before the farmer can fence each of the corners, then the cows win by just having that one cow head straight for the border and then walk along the border until it reaches someplace that has not yet been fenced (you can see this by a pigeonhole argument: the number of turns it takes for that cow to visit every border square is smaller than the number of border edges, so by the time the cow visits all of them they can't all have been fenced).