Halò a charaid! 😄
The Spanish did NOT go home. We stayed, refactored the whole thing, and now the French border patrol is asking us for immigration advice.
Turns out this puzzle isn't about Java or C++ or even Py/TS. It's about one simple abstraction:
interface Shape {
color: string;
canMove(direction: Direction, board: Board): boolean;
blocks(other: Shape): boolean;
interactsWith(other: Shape): Interaction;
}
class UShape implements Shape {
constructor(public color: string) {}
// ... you know the rest
}
class Puzzle {
private shapes: Shape[] = [];
addShape(shape: Shape) {
this.shapes.push(shape); // ← arbitrary, baby
}
}
Enter fullscreen mode Exit fullscreen mode
The French claimed "even a configurable in-memory list can't work". But that's because they were thinking in if (color === "black") blocks instead of polymorphism.
The cyclomatic complexity doesn't grow with the number of shapes. It stays at O(1) when you invert the dependency correctly.
TL;DR: List<Shape> exists. The Spanish Empire of Abstraction stands undefeated. 🇪🇸
Thanks for the fun puzzle — this is exactly the kind of thinking that separates "it works" from "it scales". Also, your Scottish Gaelic intro made my week. Tapadh leibh!
Nos vemos en el siguiente reto 🧩
0 Comments
Log in to join the conversation.No comments yet. Be the first to share your thoughts.