Tower Breakers

Sort by

recency

|

396 Discussions

|

  • + 0 comments

    This may be the most horribly written "coding problem" I've ever seen,

  • + 0 comments

    This is a trick test. The height of the towers is almost irrelevant, since P1 always plays first and plays optimally they will always win when there's an odd number of towers, while P2 always wins when there's an even number of towers.

    The only exception to this rule is if m == 1, in that case P1 won't have a move to begin with and P2 wins.

  • + 1 comment

    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.