Ad
  • Custom User Avatar

    imo this is really elegant

  • Custom User Avatar

    The first solution that actually takes into account that no constraints have been placed on the numbers in the description. =)

  • Custom User Avatar

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

  • Default User Avatar

    Thanks for your translation! Very well followed the original... Nice job.

  • Custom User Avatar

    I've added a new java translation for review.

  • Default User Avatar

    Thanks... Recognizable! I also had to change my direction several times until I could solve.

  • Custom User Avatar

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

  • Custom User Avatar

    Fun and challenging kata! can't wait to try the 6x6

  • Default User Avatar

    @OzzyD Thanks Ozzy. I have actually modeled this problem after my own garage door :-), which can harm pets both ways. I will try to add the double-press improvement, but my intent is to keep the problem description as simple as possible. Cheers!

  • Custom User Avatar

    Thanks;-)! Probably time for holidays... :-) (after completing #4000;-))

  • Default User Avatar

    Congrats !
    ; ) )

  • Custom User Avatar

    I'd suggest obstacle detection should only occur when closing.
    If the door is opening it wouldn't matter; in this case if opening and an obstacle occurs it'd start closing and squish a pet. - This sounds like the original problem the company probably wants to solve. ie When an obstacle is detected the door should begin opening if closing. If already opening and an obstacle is detected continue opening.

    An additional intersting additonal would be a double press of the button would reverse direction. And further to that a double press after obstacle would ignore any further obstacles until closed.

  • Custom User Avatar

    You can also replace this lambda

    size -> new String[size]
    

    by a method reference

    String[]::new
    
  • Default User Avatar

    Yeah I tried submitting my solution in 'Train' mode and had the same issue (no issue when validating in kata creation mode). I ended up setting a package for all of the classes (test classes and initial code template) which seems to have fixed the issue. Try setting the package org.codewars.kata.dynamicjava for your solution and custom tests and see if that fixes it.

    I changed all of the package names in the code to be compiled in the test cases to org.codewars.kata.dynamicjava as well but playing around a bit with the custom test cases in 'Train' mode no matter what I tried setting the package names to in the code to be compiled it didn't seem to cause any errors. I think the problem only occurs if the test class or solution class uses the default package and you try to load a class with a non-default package name. And this problem only seems to occur in 'Train' mode.

  • Custom User Avatar

    Yeah seems to be something with CodeWars. If I put a package on the unit tests it gets 'stuck' in that package even after removing it.
    For some reason for submitting, if the solution is not in a package it returns;

    Could not find ["my.project.CompilerTest" #<Kind CLASS>] among possibilities: (["CompilerTest" #<Kind CLASS>] 
    

    And when in the package it returns

    /my/project/CompilerTest.java:14: error: cannot find symbol
    Class testClass = DynamicCompiler.compileAndLoad(name,
    ^
    symbol: variable DynamicCompiler
    location: class CompilerTest
    /my/project/CompilerTest.java:31: error: cannot find symbol
    

    Giving an empty class also has the submit report the /my/project path for CompilerTest, seems it's stuck running the test cases out of a different directory.

    Edit: It seems the package stickign only occurs on this kata for me. Tried on another with putting the test cases into a package and all was fine after removing it.
    There was another comment on the forum about this kata and someone else having the same issue.

  • Loading more items...