6 kyu

Save the Spice Harvester (Dune Universe)

326 of 810docgunthrop
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • Schulzkafer Avatar

    PHP:

        $this->assertSame("Damn the spice! I'll rescue the miners!", harvester_rescue([
          'harvester' => [0, 0],
          'worm' => [[0, 600], 50],
          'carryall' => [[0, 880], 80]
        ]));
    

    Fixed tests have this test, where the harvester can be saved by carryall at the same moment as the harvester can be eaten by worm, but the description says nothing about it.

  • Schulzkafer Avatar

    PHP: There are no "fixed tests" in "Sample Tests"

  • JohanWiltink Avatar

    Update to JS Node 18.x

  • bupjae Avatar

    "Sample test" of golang is broken.

    line 21 says ::

        for i, dat := range example_tests {
            It(fmt.Sprintf("Testing: %+v", dat), func() { Expect(HarvesterRescue(dat)).To(Equal(example_solutions[i])) })
        }
    

    In this case, inner closure pickups variable i and dat that will be changed by for loop. In pactice, test suit will run after dat and i is bounded to last test case, and then, all Except function will called with same test case.

    To fix this, this should be modified as:

        for i, dat := range example_tests {
            i, dat := i, dat    // Create new variable; following closure will pickup right value.
            It(fmt.Sprintf("Testing: %+v", dat), func() { Expect(HarvesterRescue(dat)).To(Equal(example_solutions[i])) })
        }
    
  • Ciprian Amza Avatar

    Great kata!

  • CaseyPitman Avatar

    Loved seeing Dune show up. I enjoyed this one. I had to fall back on that high school Algebra I thought I'd never have to use (thanks Mr. Mitchell!).

    "Fear is the mind-killer."

  • RomulusReiter Avatar

    Wery intresting kata.Dune is my favorite universe! The Spice must flow!!!

  • docgunthrop Avatar

    Elixir and Go translations published.

  • KataSideKick Avatar

    C# Translation added.Please review and approve~

  • eb110 Avatar

    It's such a shame that Rakis is just a burnt planet now...

  • Keozon Avatar

    This comment has been hidden.

  • glynester Avatar

    Awesome kata! Interesting, well explained and great footage! :)

  • Hullaballoo Avatar

    Added Java Translation

    Data takes form of 2D array.

    EDIT - Adjusted Random Testing to be consistent with original Kata.

  • user9291179 Avatar

    Added Rust translation.

    Several of the types had to be changed (a struct for the data, tuples instead of arrays, etc.) but the initial solution and example test cases should suffice to make the differences clear.

  • docgunthrop Avatar

    Python translation published.

  • Voile Avatar

    Approved

  • donaldsebleung Avatar

    PHP Translation Kumited - please carefully review and approve :D

  • JohanWiltink Avatar

    The reference solution only checks if the carryall can be there (and lift, &c) before or at the exact moment when the worm gets there. And the tests don't catch this. The description seems written to imply the carryall has to get there first (if only by ε).

    Also, the return value when giving up on the harvester is different in the description and in the tests.

  • docgunthrop Avatar

    Thanks for checking out my first published kata. If you find any issues or bugs, go ahead and post in this Discourse section and I'll look into fixing them.