Design Animal Chess game classes
DuolingoSoftware Engineer · Technical ScreenLast updated
This interview question evaluates requirements, scale assumptions, API/data design, architecture, trade-offs, failure modes, and rollout in a realistic interview setting. A strong answer for Design Animal Chess game classes states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
Question
Design a simple Animal Chess game using object-oriented principles. Define piece classes (Elephant, Lion, Tiger, Leopard, Wolf, Dog, Cat, Rat) with their unique movements; model a 9×7 board with rivers, traps and dens; implement movement and capture logic; create an API to initialize, place pieces and display state; and supply test cases showing board setup, a lion capture, and a multi-move turn.
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.