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.
no answer from OP
I've just double-checked and both the author solution and the reference solution return
false
for the inputs[ [ 19, -24 ], [ 58, -70 ], [ 24, -31 ], [ -18, 18 ], [ 16, -25 ] ]
.Is this a recurring issue? Do you have another example?
the author's solution returns
false
for this input. when i try your solution, it incorrectly returnsfalse
for aligned points, e.g.[ [32,-66], [42,-82], [-18,14] ]
[ [ 19, -24 ], [ 58, -70 ], [ 24, -31 ], [ -18, 18 ], [ 16, -25 ] ]
Do you have an example of such test?
Random Tests in JS give points that are not part of the line and yet.. test want it to be TRUE
description should be language-agnostic
approved
JavaScript reference solution is very broken, failing to handle negative numbers or those with more than one digit. The fact that it works vaguely as intended is a lucky coincidence - but not always.
onLine([[-6,-9],[-6,5],[-6,-2]]): expected true to be false
onLine([[30,15],[36,18],[32,14]]): expected false to be true
The author solution is also wrong, failing to differentiate between negative and positive gradients:
onLine([[-11,-1],[-9,1],[-10,-2]]) === true
. The fact that this passes the tests is again, dumb luck and insufficient test coverage.Finally, test generation is needlessly iterative, sometimes calling the reference solution 30,000 times to generate 100 random tests.
Function call count for reference solution: 28582
.Fork:
https://www.codewars.com/kumite/667cbb20086a7f00f6dbc907
Fixes:
on_line(((1,1)))
should beon_line(((1,1),))
Ruby 3.0 should be enabled
No random tests in Ruby
JavaScript Fork, added random tests, Chai assertions.
Fixed in latest fork
Loading more items...