Warning: session_start(): open(/var/lib/php/sessions/sess_b7em249iluhloh1lrbo2apotfl, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
persistable sclass FloodFill is Steppable {
// input
int w, h;
swappable bool isConnectable(Pt a, Pt b) { throw unimplemented(); }
void visited(Pt p) {}
// internal
new L stack;
BitMatrix visited = new BitSetMatrix;
*(int *w, int *h) {}
bool isPointVisited(Pt p) {
ret visited.get(p);
}
void startAt aka addPoint(Pt p) {
if (p.x < 0 || p.y < 0 || p.x >= w || p.y >= h) ret;
if (isPointVisited(p)) ret;
stack.add(p);
addedPoint(p);
}
void addedPoint(Pt p) {}
public bool step() {
if (empty(stack)) false;
Pt p = popLast(stack);
int x = p.x, y = p.y;
visited.set(p, true);
visited(p);
possibleBridge(p, new Pt(x-1, y));
possibleBridge(p, new Pt(x+1, y));
possibleBridge(p, new Pt(x, y-1));
possibleBridge(p, new Pt(x, y+1));
true;
}
void possibleBridge(Pt a, Pt b) {
if (isConnectable(a, b)) {
addPoint(b);
createBridge(a, b);
}
}
void createBridge(Pt a, Pt b) {}
}