Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Updated description
The description is inconsistent with regards to the valid room coordinates vs dimensions. Based on the given ASCII image of a
(5,5)
-sized room, the robot has5 x 5 = 25
valid room coordinates, suggesting that "width" and "height" refer to the number of valid discrete positions. However, the reference solution, which sets walls at-1
and6
, allows room coordinates0 <= x <= 5
and0 <= y <= 5
, implying6 x 6 = 36
valid coordinates, or a(6,6)
-sized room. Adding to the inconsistency, the valid starting positions are differently constrained at1 <= x <= 5
and1 <= y <= 5
.I can see two solutions to this:
Continue to constrain valid room coordinates at
0 <= x <= width
and0 <= y <= height
as now, but constrain the starting positions similarly, and fix the ASCII image. The benefit of this approach is that existing solutions won't be invalidated. "Width" and "height" would refer to physical dimensions on a continuous coordinate plane instead of the number of possible discrete positions.Set the bottom-left wall at
0
, which would constrain valid room coordinates at1 <= x <= width
and1 <= y <= height
. This would of course invalidate all existing solutions. "Width" and "height" would refer to the number of possible discrete positions intead of physical dimensions on a continuous coordinate plane.Fixed test cases to sync with description. Plus made walls positions clearer.
Sample battery removed tests doesn't sync with description. The tests wants you to return
"robot is stuck at {x}x{y}. Battery removed!"
instead of(x, y)
tuple.Also, please specify where the walls position at (as mentioned by Voile).
Updated description to better clarify the walls axis. Marking as solved
Made the description clearer on what direction represents which axis direction, marking as solved.
Added random tests, marking as solved.
Output and coords only use tuple now. Marking as solved
There's no clear indication as to which of width and length corresponds to
x
axis andy
axis. (For example, we can make [2, 3] into two x-axis length 2 walls with two y-axis length 3 walls or two x-axis length 3 walls with two y-axis length 2 walls).Returning different types (string/list) is bad practice
In python coords should be tuples, not lists
Needs random tests.
It's unspecified which of up/down/left/right corresponds to which of the -x/+x/-y/+y direction.
It's not even specified what the coordinates of the walls are at. Why are the walls at
x = 1
andy = 1
instead ofx = 0
andy = 0
? This would make a room of widthw
and heighth
of dimensionw - 1
andh - 1
, which is mathematically inconsistent.HERE NOW
(built from seraph's original change to any type)
Well, declaring as a string forces any input to be formatted as a string, from what I can tell, so I just put an int as the test to make sure that the code runs for all possible inputs, including potential miscommunication with the script for "None" or "Null" jokes.
Loading more items...