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.
You could replace
def pyramid(n) when n == 0, do: []
withdef pyramid(0), do: []
This comment is hidden because it contains spoiler information about the solution
Forked this to avoid potential redundancy of repeated tests.
defp rand_int(), do: 2..80 |> Enum.filter(fn x -> x not in [4,7,15,25] end) |> Enum.random
As 4,7,15,25 are already tested in the prior tests.
@Steffan153, whoops, you're right. PascalCase is what I meant 🙃
camel case is camelCase, that's PascalCase.
One other thing -- Elixir naming convention for modules is CamelCase. I forgot to change it here, but it's not a big deal as it doesn't have any effect on the kata.
I forked your translation here: https://www.codewars.com/kumite/5db25e422f349c0015b154ca?sel=5dc70c502c135e0016bf8b75
Some changes and recommendations:
start
tocreate_spiral
defp
instead ofdef
)describe
blockOne other change I made was to the random number generator; changed it from selecting from the range
0..100
to2..80
. This is because0
and1
are already tested in the fixed tests, so we can avoid potential redundancy there. The upper bound was decreased due to the variance in completion time; lowering it ensures that the test setup doesn't become the bottleneck.EDIT: for bullet point #2, I meant to say "functions that don't need to be accessed from outside the module" should be set to private.
Awesome, that is helpful to know. I have updated the kata details accordingly, and updated the solution to a matrix of integers.
Thanks for that tip!
You can override the default output format so it doesn't display as a charlist.
Pardon me, this is my first attempt at a kumite.
I have now updated it to include truly random tests between 100.
Also, regarding using strings instead of integers; its because lists in erlang are basically binary char lists, and certain combinations of numbers emit random strings..
We could change this to be by numbers.. Its just that the output wont look like what people are expecting even though its technically accurate.
Another question -- why use strings rather than integers? The other translations use integers.
There don't appear to be any random tests. Are you sure you updated it?
Updated to include random tests.
The full test suite should include random tests.
indeed, its not a kata issue.
Loading more items...