Bird
0
0

How would you extend a move validation system to handle special chess rules like castling and en passant without compromising modularity?

hard📝 Trade-off Q9 of 15
LLD - Design — Chess Game
How would you extend a move validation system to handle special chess rules like castling and en passant without compromising modularity?
AIgnore special moves to keep code simple
BAdd separate validation modules for special moves integrated into main validation flow
CHardcode special move rules inside the main validation function
DValidate special moves only after the game ends
Step-by-Step Solution
Solution:
  1. Step 1: Understand modular design principles

    Modularity means separating concerns into independent components.
  2. Step 2: Apply modularity to special move validation

    Using separate modules for special moves keeps code clean and maintainable.
  3. Final Answer:

    Add separate validation modules for special moves integrated into main validation flow -> Option B
  4. Quick Check:

    Separate modules for special moves maintain modularity [OK]
Quick Trick: Use separate modules for special move rules [OK]
Common Mistakes:
  • Hardcoding special rules
  • Ignoring special moves
  • Delaying validation until game end

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes