DEV Community

Discussion on: Interview Question: A two-player card game

Collapse
 
moopet profile image
Ben Sinclair

This was my initial thought too. As it's a simulation you can map the steps to functions that pop N from the list and determine the index of the player which wins.
That extends to as many players as you want without using classes (which in this test, YAGN...) and only becomes trickier in the later parts of the question where new rules are introduced.

At that point I can see myself preferring to defend my assumptions for a while before actually changing any code.