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.
an easy one
Sure.. Thanks!
Okay so I will try and fix the message, but as Chrono said: your ghosts are all of color
undefined(i.e.ghost.colorisundefinedfor each ghost instance you create).This comment is hidden because it contains spoiler information about the solution
Yeah but still, the message as reported by OP looks strange. If I only had the failing code at hand so I could test it...
That your class doesn't have a color property defined, that's why
undefinedis not one of those 4 colors.Javascript, Node v18.x
What does this means?
Test Results:
Ghost
should be one of the four colors
expected [ 'white', 'yellow', 'purple', 'red' ] to include undefined
I am afraid that this is just a knowledge gap and lack of familiarity with the thing called "classes". It is true that if someone does not know what classes are, they will not understand the wording. If someone learns what classes are, will find the wording accurate. For example "to instantiate" is an accurate term related to handling classes and instances, and "created" or "made" would be an imprecise simplification. Very similarily, the "Ghost objects are instantiated without any arguments" part: if a solver knows about classes, objects, instances, and costructors, the wording starts making sense.
So yes, it does seem to be a knowledge gap. The kata is tagged as
OBJECT ORIENTED PROGRAMMINGso it would be good to research this area before approaching it, because it provides knowledge necessary to solve it. It does not require any advanced knowledge, it's all rather basic topics, but from a specific(ish) area.The only instruction given is "Create a class Ghost" - I've recently finished studying the fundamentals of JS and the request here doesn't make sense to me (classes are something I've only covered in CSS/HTML), it's also not clear if it's asking us to create A class CALLED 'Ghost' or if "Ghost" itself refers to a specific coding function? (I suppose this may be a knowledge gap). The rest of the text provided is not provided as an instruction:
Ghost objects are instantiated without any arguments.
Ghost objects are given a random color attribute of "white" or "yellow" or "purple" or "red" when instantiated
This is just factual information, not an instruction. If intended as an instruction, what exactly are we being asked to do, here? Are they asking us to create a "ghost" object w/o any arguments and give is a random colour? Because that isn't clear. (Instantiated is also verbose, when writing instructions one should keep the language as simple as possible, they could instead have just said "created"/"made"/"started".)
While theoretically true, I doubt you'll ever find a seed like this. Not an issue.
The test in the Python version does not meet the requirements. There can be colors which have zero occurances depending on the random seed used.
Added such tests for Java, C#, and JavaScript.
Added such tests for Java, C#, and JavaScript.
Added sample tests showing the expected API.
Added some more validity tests and approved.
Loading more items...