A problem inspired by the game, Infinity Loop, for iPhone and Android.

Consider a subset \(S\) of an infinite lattice grid, consisting of all points \( (x,y) \) where \(x,y\) are integers ranging from \(1\) to \(10\) inclusive.

Let each lattice point be assigned an integer \(a_{x,y}\) ranging from \(0\) to \(4\) inclusive. Define a **connection** of \(S\) as an operation in which you add line segments between two horizontally or vertically adjacent lattice points, such that the point \(x,y\) is connected to exactly \(a_{x,y}\) segments for all points in the set. Each pair of adjacent points may have at most one line segment connecting them. Points in the corners can have at most 2 line segments, points on the sides 3, and points in the middle 4.

Given that you know all the \(a_{x,y,}\), is it always possible to tell whether a connection of \(S\) exists?

## Comments

There are no comments in this discussion.