Tower Breakers

Sort by

recency

|

373 Discussions

|

  • + 0 comments

    js single line solution (also to make it a little more fun, chose to do it with no if statements):

    const towerBreakers = (n, m) => ((m==1)&&(2) || (2 - n%2));
    
  • + 0 comments

    I agree that the question, as is tradition on this site, is very poorly written and clearly not by someone that speaks english natively.

    The correct answer is not found in the Editorial, but is instead described pretty well on this SO answer.

    In short, 'optimal' does boil down to mirroring, because in the case that the next player does not mirror, the first can also avoid mirroring to force the same end result by bringing the invariant back into line with their victory. Look into nim games if that is not clear.

    The fact that this is ignored in the Editorial doesn't help the appearance of 'optimal' being an asinine definition of 'well just mirror because you can therefore its optimal'.

    Without knowing about nim games or just brute forcing a big truth table, this is not an easy question and is a pretty poor way to gauge understanding. Probably why it's tagged 'observation', they want you to just guess the correct answer based on simulating a few cases.

  • + 0 comments

    one thing i noticed that if number of towers i.e., n are even then player 2 will always win.

  • + 0 comments

    "optimal" really ought to mean that each player will do whatever is necessary to try and win the game themselves... in which case player 2 would often not match the move of player 1, and would thus break the symmetry rules of these simple answers.

  • + 0 comments

    WTF is an 'optimal move'? Because of 'goobledydook' player1 makes move X. WTF....