6 kyu
Multidimensional Coordinate Encoding
64 of 135dfhwze
Loading description...
Algorithms
Arrays
Mathematics
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Typo in the first example - Python description
cell (x = 8, x = 8)
=>cell (>>> y <<< = 8, x = 8)
nice spot, fixed
OCaml translation
Approved
Scala translation
If the output panel is too offensive then I can probably get some slightly nicer formatting going on with nested spec stuff.
approved, thanks
In the 1st example:
(8 = 1, x = 8)
should be(y = 8, x = 8)
the encoded value for a coordinate is its value times then the product of all lower dimension sizes
(then
->the
)fixed
Typo: Exaplanation
fixed
not sure there is an actual point, but... Maybe add some encoding and decoding tests where dimensions are arrays of ones only? (mostly for the :cough: fun of it...)
pointless feature, I love it! test case added
Decode random tests generate
encodedPoint
s that are outside of their dimensions, eg.Invalid solution for dimensions [1] and encoded point 1: expected [ 0n ] to deeply equal [ 1n ]
. See this fork.I'm unsure if this is an
Issue
, but it breaks normal modular maths.Is this intentional?
This is not intentional, but for some reason I cannot access your fork. I'll investigate.
I've changed the random input generator to use randint instead of randrange (Yep, I mimic Python in JS). Should be solved now.
Actually, your
randint
behaves like the python'srandrange
and yourrandrange
behaves like python'srandint
. Would be better to change their names... ;)Yep, solved.
No idea why you couldn't access the fork.
djeezes, I'll have to edit quite a few of my kata's xD (I'll put it on my backlog)