We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This can be solved quite simply following this logic.
If n is even, player 2 will create pairs of towers, such that whenever player 1 moves, they make the same move on the towers pair. Since the number of towers is even, this will always result in them winning.
Alternatively, in n is odd, then player 2 only wins if the height of the tower is 1
deftowerBreakers(n,m):# Write your code herereturn2if(n%2==0orm==1)else1
Tower Breakers
You are viewing a single comment's thread. Return to all comments →
This can be solved quite simply following this logic.
If n is even, player 2 will create pairs of towers, such that whenever player 1 moves, they make the same move on the towers pair. Since the number of towers is even, this will always result in them winning.
Alternatively, in n is odd, then player 2 only wins if the height of the tower is 1