You are given a 2D grid of positive whole numbers, represented as a (list (list @ud))
You start in the top left corner of the grid, and your goal is to walk to the botttom right corner by taking steps either down or to the right. Your goal is to find the path that minimizes the sum of the numbers on the path.
Your task for this challenge is to write a generator that takes a (list (list @ud))
and returns a @ud
representing the minimum sum of numbers on a path from top left to bottom right.
Example usage:
> +min-path ~[~[1 3 1] ~[1 5 1] ~[4 2 1]]
7
Here you can see the above grid represented visually, and the minimum path totaling 7 highlighted in orange.
Two winners will be rewarded. Fastest Solution will go to the first person to send in a working solution. Best Style will be measured by a variety of factors, including clarity, elegance, following Hoon-ish conventions, being well-commented, and code runtime. For examples, see the challenges and winners from our last competition [1] [2] [3]. You can also refer to the Hoon Style Guide.
For submission, fill out this google form with your information. See instructions to create the repository below. Remember to make your repo private and add tamlut-modnys as a collaborator.
This challenge opens at 11am ET (8am PT, 5pm Central Europe) on August 10, and will close at the same time on August 17. Good luck!
Please do not fork this repository directly on GitHub. Instead, please use GitHub's "template" function following the instructions below to copy this repository and customize it for your project.
If you are working with a fakeship, this is one way to set things up for rapid development:
- Start a fakeship and
|mount %base
. - Clone this repo into the same directory as the fakeship, then copy the contents of
src/
intozod/base/
. - Develop either in
zod/base/
or in this repo folder directly. It's probably a bit easier to develop in the fakeship and copy back here frequently.
This repo provides test cases you can use to verify that your code submission works correctly.
To run the tests, make sure you have mounted and committed the files into the base
folder of your fake ship. Then from dojo run
-test %/tests/min-path/hoon
This will run several tests, each of which will pass or fail. For debugging help you can inspect the test code to see which ones passed and failed.
To avoid issues, make sure your generator is written in the provided file at /gen/min-path.hoon
For more info on testing in Hoon, see this link.
-
Log in to GitHub. (If you do not have an account, you can quickly create one for free.) You must be logged in for the remaining steps to work.
-
On this page, click on the green "Use this template" button (top right)
-
Select the owner for your new repository. (This will probably be you, but may instead be an organization you belong to.)
-
Choose a name for your copy of the archetype repository. We recommend you call it
ha-min-path
(no 'template'). -
Make sure the repository is private, leave "Include all branches" unchecked, and click on "Create repository from template". You will be redirected to your new copy of the template respository.
-
Share the repo with tamlut-modnys on Github as a collaborator.
After this is complete, you can use this repo to handle your competition development and submission. Please note that by submitting a solution, you allow it to be made public under the MIT license.