{"id":41653855,"url":"https://github.com/dnnrly/puzzle-template","last_synced_at":"2026-01-24T16:20:06.314Z","repository":{"id":57559357,"uuid":"323108873","full_name":"dnnrly/puzzle-template","owner":"dnnrly","description":"A generic template for puzzle projects such as Project Euler or Advent of Code","archived":false,"fork":false,"pushed_at":"2022-12-05T22:15:34.000Z","size":3810,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-06-20T15:55:19.768Z","etag":null,"topics":["advent-of-code","euler","go","golang","hacktoberfest","project-euler","puzzle","puzzle-template","template-project"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dnnrly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-20T15:55:30.000Z","updated_at":"2021-10-01T16:45:56.000Z","dependencies_parsed_at":"2023-01-23T04:15:23.023Z","dependency_job_id":null,"html_url":"https://github.com/dnnrly/puzzle-template","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dnnrly/puzzle-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnnrly%2Fpuzzle-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnnrly%2Fpuzzle-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnnrly%2Fpuzzle-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnnrly%2Fpuzzle-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnnrly","download_url":"https://codeload.github.com/dnnrly/puzzle-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnnrly%2Fpuzzle-template/sbom","scorecard":{"id":348722,"data":{"date":"2025-08-11","repo":{"name":"github.com/dnnrly/puzzle-template","commit":"806abccf7023797068045feaf6b03731e1c64d14"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 1/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: topLevel permissions set to 'read-all': .github/workflows/codesee-arch-diagram.yml:12","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/codesee-arch-diagram.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/dnnrly/puzzle-template/codesee-arch-diagram.yml/main?enable=pin","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2022-0603 / GHSA-hp87-p4gw-j4gq"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T07:47:27.112Z","repository_id":57559357,"created_at":"2025-08-18T07:47:27.112Z","updated_at":"2025-08-18T07:47:27.112Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28731224,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["advent-of-code","euler","go","golang","hacktoberfest","project-euler","puzzle","puzzle-template","template-project"],"created_at":"2026-01-24T16:20:04.039Z","updated_at":"2026-01-24T16:20:06.281Z","avatar_url":"https://github.com/dnnrly.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Puzzle Template\n\nThis is a template that will allow you to solve programming puzzles with out worrying about the mechanics of managing a project.\n\nFor more information about the kind of delightful puzzles I'm talking about, you should visit https://projecteuler.net and\nhttps://adventofcode.com/. It's fun, really, trust me!\n\nThis assumes that you have the following installed:\n* [Go](https://go.dev/)\n* [Make](https://en.wikipedia.org/wiki/Make_(software))\n\nYou can run this template anywhere you can install these tools (technically, you don't even need make). I've even run this on phone with [Termux](https://termux.com/)! There's no excuse for not giving it a go. :)\n\nIf you want to know more about Go then a great place to start is the [Go Tour](https://tour.golang.org) followed quickly by [Effective Go](https://golang.org/doc/effective_go.html) and [Go By Example](https://gobyexample.com/).\n\nThere are some helpers in [puzzle.go] - but I've not made it TOO easy, you will have to fill these out yourself. Maybe you could extend them in interesting ways? What if you had a nice way of caching prime numbers perhaps? I'll leave it up to you.\n\nThis project is based my original template for Project Euler that can be found at https://github.com/dnnrly/euler-template.\n\n## Creating your own version\n\nTo solve the puzzles you will need to fork this project in to your own user area. From there, clone it to a local computer and you're ready to go. You can find istructions on how to do this in Github itself.\n\nIf there are ANY problems with this template then feel free to raise an issue and I'll see what I can do. But beware, \"I can't figure out the solution with puzzle X\" does not constitute a problem with this template. Chances are that I haven't solved that one either. To be honest, I've only solved the first 10 anyway.\n\n## Running your puzzles\n\nAll of these steps assume that you have Make installed. If you don't you can check out the contents of `Makefile` to see the real shell command being run for each target.\n\nTo run all of your puzzles:\n```bash\n$ make run-all\n```\n\nTo run only the last test:\n```bash\n$ make latest\n```\n\nTo run a single other test:\n```bash\n$ go run cmd/puzzle/main.go 4\n```\nOr you could use a different number. 4 is my favourite. :)\n\n## Adding the next puzzle\n\nIt is possible to generate a new file for your next puzzle using the following command from the root of the project:\n```bash\n$ make next\n```\n\nAfter this, it's up to you to solve the puzzle. The thing that's just been generated will look a little like this:\n```go\nfunc Puzzle001() Puzzle {\n    // In this function, you can add large strings (your input data, perhaps) so\n    // that they can be parsed in the initialisation phase of the puzzle and won't\n    // count to the time taken for your algorithm.\n    data := `1\n2\n3`\n\n    // You can add multiple variables that you use later on if you wish.\n    values := []int{}\n\n    // And you can even add helpers that can be called only from inside your\n    // puzzle solution.\n    convert := func(s string) int {\n        v, _ := strconv.Atoi(s)\n        return v\n    }\n\n    return Puzzle{\n        // Init will be called before any of the solutions. Do all of your\n        // expsensive pre-processing here.\n        Init: func() {\n            lines := strings.Split(data, \"\\n\")\n            for _, l := range lines {\n                values = append(values, convert(l))\n            }\n        },\n\t\t// Parts contains all of the different sub-solutions that you need\n\t\t// to implement (looking at you Advent of Code).\n        Parts: []Solution{\n            // You can consume the pre-processed data in the solutions here\n            func() int { return values[0] + 100 },\n            func() int { return values[1] + 100 },\n            func() int { return values[2] + 100 },\n        },\n    }\n}\n```\n\nOnce you've got the answers you need, I would recommend something like the following:\n```bash\n$ git add .\n$ git commit -m \"Add solution to puzzle $(ls -l | grep puzzle | wc -l)\"\n$ git push\n```\n\n## Adding tests for your puzzles\n\nSometimes it's necessary to check that your code is doing what you expect without actually solving a puzzle. For example, you might want to check that a new prime number checker algorithm works. In this case, you would simply add a `_test.go` file the you would do normally and add your test code there. To execute the tests, use the following:\n```bash\n$ make test\n```\n\nJust beware, if you create your helper functions inside your generated puzzle function then they won't be accessible from your tests. To get around this, just create them outside of this function. And remember that `common.go` has been created for those helpers that you think might be used by several puzzles.\n\n## Contributing to this template\n\nFeel free to fork this repository and raise a pull request for any changes.\n\nTo run the on the framework as well in the puzzle package, you will need to do the following:\n```bash\n$ make test test-all acceptance-test\n```\n\nThe last target will run the `next` and `puzzle` commands, making sure that the generated code builds and runs - it doesn't do any fancy validation.\n\nThis will run the tests for the different individual commands.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnnrly%2Fpuzzle-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnnrly%2Fpuzzle-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnnrly%2Fpuzzle-template/lists"}