Domanda di colloquio di Thread.com

One game problem with quite a lot rules to implement