Skip to content

Instantly share code, notes, and snippets.

@benjaminjkraft
Created November 6, 2019 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjaminjkraft/790f823e165ac82a8eafc54a4c68d197 to your computer and use it in GitHub Desktop.
Save benjaminjkraft/790f823e165ac82a8eafc54a4c68d197 to your computer and use it in GitHub Desktop.

Khan Go Contest

We have a s3cr3t repository (ok, you can probably find it, but don't peek) that we will announce right before the contest start. It's some of the exercises that were literally and liberally stolen from literally and liberally stolen from the Exercism.io Go track.

Fork this repo, solve the exercises, and submit a pull request TO THIS REPO, NOT EXERCISM/GO for judging with the description containing your personal Tally. No more commits after the time limit, but you can fuss with your Pull Request more.

Please notify the judges in Slack the #go-contest channel which one, if any of your fully 100% passing solutions, should be considered for Special Awards:

  • Greased Lightning Performance Award - for exercises with benchmarks showing that you made yours go so dang fast
  • Elegant Étude Award - for exceptional cleverness, radical simplicity, and amazing aesthetics to your solutions.

Contest Scoring rubric:

Each exercise in this repository is worth 0 to 5 points. A solution that will pass all the tests will get 5 points, and -1 point for every test or test case, or example test that fails. The minimum score for each exercise is 0.

Some exercises are easier and quicker to solve than others (Hint: Start with Darts). A good developer skill to practice is recognizing a tar pit and avoiding it!

If you are reading past this before you tried it and got stuck, you are wasting precious time!

Development setup

You will need a github account and you will need to fork StevenACoffman/go to your account. See GitHub Help if you are unfamiliar with the process. Clone your fork with the command: git clone https://github.com/<you>/go. Test your clone by cding to the go directory and typing bin/test-without-stubs. You should see tests pass for all exercises.

This repo only imports from the standard library and isn't expected to be imported by other packages. Please keep your solutions that way.

Your Go code should be formatted using the gofmt tool. For the other file types in the repository you may want to copy the setup used in the .editorconfig file from the exercism.io repository.

Exercise files.

Let's walk through an example, non-existent, exercise, which we'll call fizzbuzz to see what could be included in its implementation.

~/go/fizzbuzz$ ls
cases_test.go
fizzbuzz.go
fizzbuzz_test.go
README.md

The README.md describes the problem; your code goes in fizzbuzz.go, which contains a stub of the functions you need to define. You won't need to modify the test files, although you are encouraged to look at them for usage examples. As usual, you can run the tests with go test.

Many of the test files use "table-driven tests". Such tests will include their test cases in cases_test.go, and the code that runs them is in fizzbuzz_test.go. Some exercises can contain Example tests that document the exercise API.

Most of the exercises also include benchmark tests. You can run these with go test -v --bench . --benchmem They are not required, but take a look at them if you want to compete for the Greased Lightning Award.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment