Ad
  • Custom User Avatar

    an easy one

  • Custom User Avatar

    Sure.. Thanks!

  • Custom User Avatar

    Okay so I will try and fix the message, but as Chrono said: your ghosts are all of color undefined (i.e. ghost.color is undefined for each ghost instance you create).

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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...

  • Custom User Avatar

    That your class doesn't have a color property defined, that's why undefined is not one of those 4 colors.

  • Custom User Avatar

    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

  • Custom User Avatar

    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 PROGRAMMING so 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.

  • Custom User Avatar

    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".)

  • Custom User Avatar

    While theoretically true, I doubt you'll ever find a seed like this. Not an issue.

  • Custom User Avatar

    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.

  • Custom User Avatar

    Added such tests for Java, C#, and JavaScript.

  • Custom User Avatar

    Added such tests for Java, C#, and JavaScript.

  • Custom User Avatar

    Added sample tests showing the expected API.

  • Custom User Avatar

    Added some more validity tests and approved.

  • Loading more items...