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.
i love it
One comment said that only the last digit is allowed to be an X.. meh
Have to change the prototype in C++!!
Common best practice is to always work with contiguous structures as arrays or vectors when dealing with INDEXES or VERTICES in graphics.
You are using
#include<vector>
and.. returning a pointer to an array ?? REALLY ??this is not a function technically
I really like the task, but the implementation ignores a lot of C++ authoring guidelines (and iiuc, pretty much on purpose), that's why I afraid it is quite unlikely it ever gets approved, and that is a shame.
I would suggest re-making this kata with the guideline in mind.
If you have any problems with that, feel free to ask in #help-author about anything you like.
Cheers!
@Masterride05
This is a part of the standard library and in most cases a preferred way to pass dynamically sized arrays around. Also it is the preferred way on CW
It doesn't add a challenge in any meaningful maner, all it adds is unnecessary inconvenience.
C++ should use
std::string
and not C-strings: https://docs.codewars.com/languages/cpp/authoring/This kata is a duplicate: https://www.codewars.com/kata/5168bb5dfe9a00b126000018
Raw pointers in C++. Yuck!
I'll fix it right now*
Alright! I'll add more information about what is missing / not good!
Alright thanks for the feedback, i'll fix it right now!
The
nullptr
is a mistake pretty much, but keep in mind that i aim to keep this kata for C++ only, or maybe C but not in js for now.. Because of allocating an array and everything. It would be "unfair" towards say C++, since my idea was to NOT return a vector but allocate memory yourself.Well yeah true, about an empty model, but at that point you would allocate an empty array.. might as well parse in a nullptr, you know
Hello, my idea was to just make a function which returns an allocated array of vertices and sets the amount somewhere else. Of course a vector would do the same stuff, but i think it is a good training to do it ourselves rather than stick too much to vectors.
Not that they're bad though, i used them myself in my solution. It's just an added challenge to allocate an array and stuff.
By the way, the idea came from a personal project of mine. Which is why i use a pointer instead of a vector.
Should be
0 <= i
. Also< inf
is undesirable here: language lawyers will argue with you how integers aren't arbitrarily sized. It should be removed.nullptr
is not an empty array; the latter would be a zero-sized object which has different behaviour from a reference tonullptr
, and in almost all other languages empty array is definitely notnull
.Also I'd argue that zero faces is a valid input. Why can't I have an empty model?
Design question: Is there any reason to modify
unsigned int *count
and returnVertex*
inside a function when it's equivalent tostd::vector<Vertex>
, and test fixture usesstd::vector<Vertex>
as expected value? Since this is a C++ kata and not a C katastd::vector<Vertex>
would be the natural choice except for very specific reasons, which I don't see any.Loading more items...