Tower Breakers

Sort by

recency

|

394 Discussions

|

  • + 0 comments

    Python:

    def towerBreakers(n, m):
        if m == 1:
            return 2
        else:
            if n % 2 == 0:
                return 2
            else :
                return 1
    
  • + 1 comment

    Description: In each turn, a player can choose a tower of height and reduce its height to, where and evenly divides. There are towers, each 6 units tall. Player has a choice of two moves: - remove 3 pieces from a tower to leave 3, as 6 mod 3 == 0 - remove 5 pieces to leave 1
    In what world does 5 evenly divide 6 ? This is not a test of programmers skill, but pure pure mathematics and ones ability to interprete a badly written set of requirements.

  • + 0 comments

    The problem statement is clear but could be more precise. Explicitly stating that both players play optimally would remove ambiguity. The phrase "evenly divides" should be clarified as "a proper divisor of x." Additionally, specifying whether any valid divisor can be chosen or if constraints (e.g., odd-only reductions) apply would improve clarity. Finally, explicitly mentioning that if m = 1, Player 1 loses immediately would help avoid confusion.

  • + 0 comments

    def towerBreakers(n, m): if m == 1: return 2 if n % 2 != 0: return 1 else: return 2

  • + 1 comment

    One could also remove 4 and have the tower with 2 pieces left, as 6 mod 2 = 0.