Ad
  • Custom User Avatar

    I have fixed both sample tests and test cases file. As you have already attempted it, your sample test section will keep showing old code. In that case you can copy paste this new code in sample tests section.

    import org.junit.jupiter.api.Test;
    import static org.junit.jupiter.api.Assertions.assertEquals;
    
    class SampleTests {
        private static void doTest(boolean actual, boolean expected) {
            assertEquals(expected, actual);
        }
      
        @Test
        void FixedTests() {
            doTest(Kata.willRobotsCollide(0, 0, 1, 0, "UL"), true);
            doTest(Kata.willRobotsCollide(0, 0, 0, 1, "LRLR"), false);
            doTest(Kata.willRobotsCollide(5, 1, 1, 5, "LRUURLDDLR"), true);
            doTest(Kata.willRobotsCollide(5, 0, 1, 5, "LRUURLDDLR"), false);
            doTest(Kata.willRobotsCollide(4, 2, 3, 2, "R"), true);
            doTest(Kata.willRobotsCollide(4, 2, 3, 2, "D"), false);
            doTest(Kata.willRobotsCollide(8, 6, 8, 6, ""), true);
            doTest(Kata.willRobotsCollide(8, 6, 8, 7, ""), false);
        }
    }
    
  • Custom User Avatar

    Please Copy-paste eight sample test cases as fixed test cases in Test Cases file.

  • Custom User Avatar

    Random test cases should test for generate-random-case 500 too (100 test cases of parameter 500). Because we don't want brute force solution to pass the tests. We want only most optimized solution to pass the random test cases.

  • Custom User Avatar

    Done.

  • Custom User Avatar

    Should I mark this issue as resolved?

  • Custom User Avatar

    How do I include it? Commented solution at the bottom of test cases file?

  • Custom User Avatar

    I DMed the solutions on Discord. My username is pythonist1159 there.

  • Custom User Avatar

    Please add four new test cases in Sample tests and Fixed/Basic tests of OCaml translation.

  • Custom User Avatar

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

  • Custom User Avatar
    let trueCount = 0;
    for (let i = 0; i < 100; i++) {
        const [x1, y1, x2, y2, cmds, expected] = generateTestCase(randInt(1000));
        if (expected === true) trueCount += 1;
    }
    
    console.log("JS true count", trueCount);
    

    Output:

    JS true count 58
    JS true count 49
    JS true count 54
    JS true count 58
    
    true_count = 0
    for _ in range(100):
        x1, y1, x2, y2, cmds, expected = generate_testcase(random.randint(0, 1000))
        true_count += int(expected)
    
    print("Expected True Count:", true_count)
    
    

    Output:

    Expected True Count: 53
    Expected True Count: 58
    Expected True Count: 55
    Expected True Count: 62
    

    To be more precise, It is around 55/45 for JS and Python.

  • Custom User Avatar

    If you want me to set specs back to 500, I will do it.

    Coming to random spray, it is generating around 50/50 true/false, at least for Python and JS.

  • Custom User Avatar

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

  • Custom User Avatar

    The system is not letting me approve your translation due to merge conflict in Problem statement. BTW I have made some changes in test cases and problem statement, I encourage you to update Scala and OCaml translations accordingly.

    1. Change in Constraints
    0 <= x1, y1, x2, y2 <= 1000
    0 <= len(commands) <= 1000
    
    1. Four new test cases added in Sample Tests and Fixed Tests.
    2. Random test cases are now of random lengths. The len(commands) for each test case is calculated randomly.
  • Custom User Avatar

    I updated the test cases according to your suggestios. I encourage you to update Haskell translation accordingly.

    1. Change in Constraints Constraints set back to 500 but includes 0.
    0 <= x1, y1, x2, y2 <= 500
    0 <= len(commands) <= 500
    
    1. Four new test cases added in Sample Tests and Fixed Tests.
    2. Random test cases are now of random lengths. The len(commands) for each test case is calculated randomly.
  • Custom User Avatar

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

  • Loading more items...