The total number of cells(63) should at least be divisible by the given width(5), this hints at a potential error in the test suite.
Could you share your code?
let buildings = numBuildings();
let gap = 1;
let currentStartColumn = 1;
let cells = 0;
repeat(buildings) {
let floors = randomNumFloors();
console.log("floors - ", floors);
let width = randomWidth();
console.log("width - ", width);
currentStartColumn = currentStartColumn + gap;
let currentFloor = 2;
let tempColumn = currentStartColumn;
buildWall(tempColumn, currentFloor);
cells = cells + 1;
tempColumn = tempColumn + 1;
repeat((width - 3) / 2) {
buildGlass(tempColumn, currentFloor);
cells = cells + 1;
tempColumn = tempColumn + 1;
}
buildEntrance(tempColumn, currentFloor);
cells = cells + 1;
tempColumn = tempColumn + 1;
repeat((width - 3) / 2) {
buildGlass(tempColumn, currentFloor);
cells = cells + 1;
tempColumn = tempColumn + 1;
}
buildWall(tempColumn, currentFloor);
cells = cells + 1;
currentFloor = currentFloor + 1;
repeat(floors - 1) {
tempColumn = currentStartColumn;
buildWall(tempColumn, currentFloor);
cells = cells + 1;
tempColumn = tempColumn + 1;
repeat(width - 2) {
buildGlass(tempColumn, currentFloor);
cells = cells + 1;
tempColumn = tempColumn + 1;
}
buildWall(tempColumn, currentFloor);
cells = cells + 1;
currentFloor = currentFloor + 1;
}
tempColumn = currentStartColumn;
repeat(width) {
buildWall(tempColumn, currentFloor);
cells = cells + 1;
tempColumn = tempColumn + 1;
}
currentStartColumn = currentStartColumn + width;
}
console.log("Total cells - ", cells);
@iHiD I think the tests expect randomNumFloors() many floors of the form WG..GW but the example in the prose shows one floor less, including the ground floor in the count.
5 wide, 4 floors
Example:
WWWWW
WGGGW
WGGGW
WGGGW
WGEGW
xxxxxxx
Test:
WWWWW
WGGGW
WGGGW
WGGGW
WGGGW
WGEGW
xxxxxxx
Anyone gotten a response to this yet?
Just draw one more floor
It’s not aligned with the instructions but it should pass the tests.
still not passing with an extra floor
Could you paste your code?
Your above code works … if you add one floor … and swap the order in which you call randomWidth() and randomNumFloors().
+cc @iHiD the tests require randomWidth() be called prior to randomNumFloors().
Pretty odd that it depends on the order functions are called but I’ve finally passed the test.
Thanks @Isaac ![]()
I was succesfull too, but bit strugling with position of the roof and number of floors (found that also ground is floor)
Hey all. So there were two things here:
- The way that the random number generation works is that when you call a function, it actually generates a real series, then the test suite retrieves that same random series to compare your result to what’s expected for that random series. That means that you do get a real set of random numbers each time, but also that testing this is a little tricky. The problem specifically in this exercise is that there are two random series (one for widths, one for number of floors) but the tests always assigned the first random series created to widths and the second to floors, when checking your code.
- The instructions and the tests were out by one.
Both fixed (deploying shortly). Thanks for fixing and helping make the exercises better ![]()

