Refactor rock–paper–scissors for config and ties
AppleSoftware Engineer · OnsiteLast updated
This question evaluates a candidate's proficiency in object-oriented design, configuration injection, extensibility, state tracking (including ties), and testability when refactoring a Rock–Paper–Scissors tournament to support configurable rounds.
Refactor an existing Rock–Paper–Scissors tournament with three robot players so that the number of rounds is configurable and the system also tracks ties. Describe the class/interface changes (e.g., Game, Match, Player, Strategy, Scoreboard, Config), how configuration is injected, how results are reported (per-player wins and total ties), and how you would make the design extensible for new strategies or gestures and testable.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.