Bird
0
0

In a turn-based game, you want to skip players who are inactive during their turn. Which design change best supports this feature?

hard📝 Trade-off Q9 of 15
LLD - Design — Tic-Tac-Toe Game
In a turn-based game, you want to skip players who are inactive during their turn. Which design change best supports this feature?
AAdd a status flag to each player and skip turns for inactive players during iteration
BRemove inactive players permanently from the player list
CReset the game when a player is inactive
DUse a stack to reorder players dynamically
Step-by-Step Solution
Solution:
  1. Step 1: Identify requirement to skip inactive players temporarily

    Players remain in the game but do not take turns while inactive.
  2. Step 2: Choose design that supports skipping without removal

    A status flag allows checking player state and skipping their turn without removing them.
  3. Final Answer:

    Add a status flag to each player and skip turns for inactive players during iteration -> Option A
  4. Quick Check:

    Status flag enables skipping inactive players [OK]
Quick Trick: Use flags to skip inactive players without removal [OK]
Common Mistakes:
MISTAKES
  • Removing players instead of skipping
  • Resetting game unnecessarily
  • Using stack which changes order incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes