{"id":35243762,"url":"https://github.com/picojr/rustower","last_synced_at":"2026-04-28T09:32:02.912Z","repository":{"id":221284475,"uuid":"336396696","full_name":"PicoJr/rustower","owner":"PicoJr","description":"tower defense programming challenge inspired by Google Hashcode","archived":false,"fork":false,"pushed_at":"2021-02-05T21:50:04.000Z","size":255,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-02-07T05:58:12.470Z","etag":null,"topics":["challenge","parser-combinators","programming","python","rust","score-calculator","solver","tower-defense","validator"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PicoJr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-02-05T21:47:29.000Z","updated_at":"2024-02-07T05:58:13.910Z","dependencies_parsed_at":"2024-02-07T05:58:13.811Z","dependency_job_id":"8b87e257-5bd2-4ecf-ba58-aae015f160f1","html_url":"https://github.com/PicoJr/rustower","commit_stats":null,"previous_names":["picojr/rustower"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PicoJr/rustower","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PicoJr%2Frustower","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PicoJr%2Frustower/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PicoJr%2Frustower/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PicoJr%2Frustower/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PicoJr","download_url":"https://codeload.github.com/PicoJr/rustower/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PicoJr%2Frustower/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32375297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T09:24:15.638Z","status":"ssl_error","status_checked_at":"2026-04-28T09:24:15.071Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["challenge","parser-combinators","programming","python","rust","score-calculator","solver","tower-defense","validator"],"created_at":"2025-12-30T05:34:32.720Z","updated_at":"2026-04-28T09:32:02.904Z","avatar_url":"https://github.com/PicoJr.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"![logo](./res/logo.png)\n\nlogo built using assets provided by https://kenney.nl/assets/tower-defense\n\n# Rustower\n\nThis repository contains:\n* The problem statement of a challenge inspired by [Google Hashcode](https://hashcode.withgoogle.com/)\n* Input/Output validator and score-calculator reference implementation (in [Rust](https://www.rust-lang.org/))\n* [Input files](./input)\n* Simple [solver](generator/solver.py) and [input parser/output dumper](generator/parser.py) (Python)\n* [Code for generating input files](generator/generator.py).\n\n**Input Files are still WIP**\n\n## Problem Statement\n\nCompute the best towers to build in order to defend against waves of units given a budget.\n\n### Input File\n\n\u003e Note: lines starting with '#' are comments, input files do not contain comments\n\u003e\n\u003e All numbers are integers\n\n```\nUNITS TOWERS WAVES BUDGET\n\n# how many of each unit type a single tower of type 0 can stop\nHIT_1 HIT_2 ... HIT_U\n# how many of each unit type a single tower of type 1 can stop\n...\n# how many of each unit type a single tower of type T can stop\n...\n\n# cost for each tower\nCOST_1 COST_2 ... COST_T\n\n# bonuses for each wave\nBONUS_1 BONUS_2 ... BONUS_W\n\n# wave 1, number of each unit\nN_1 N_2 ... N_U\n# wave 2, number of each unit\n...\n# wave W, number of each unit\n...\n```\n\n#### Constraints\n\n* 0 \u003c UNITS \u003c= 10000\n* 0 \u003c TOWERS \u003c= 10000\n* 0 \u003c WAVES \u003c= 10000\n* 0 \u003c BUDGET \u003c= 10000\n\n### Solution/Output File\n\n\u003e Note: lines starting with '#' are comments, output files do not contain comments\n\u003e\n\u003e Output file must contain exactly `WAVES` lines.\n\u003e\n\u003e Each line must contain exactly `TOWERS` integers.\n\n```\n# wave 1 towers of each type\nT_1 T_2 ... T_T\n# wave 2 towers of each type\n...\n# wave W towers of each type\n...\n```\n\n### Scoring\n\n* 1 point for each unit stopped\n* for each wave: bonus wave points if all units were stopped\n\n### Simulation\n\nFor each type of unit, compute how many units of this type towers can stop:\n\n* given a unit `i`\n* `T` towers\n\nThe number of units of type `i` stopped is sum of `N_k * HIT_k_i` for k in `0..T-1` where\n\n* `N_k` is the number of towers of type `k`.\n* `HIT_k_i` is the number of units of type `i` a single tower of type `k` can stop.\n\n### Example\n\n#### Input File\n\n```\n2 2 2 12\n2 1\n1 2\n3 4\n2 1\n1 1\n3 3\n```\n\n\u003e 2 UNITS, 2 TOWERS, 2 WAVES, BUDGET = 12\n\u003e\n\u003e 1 TOWER of type 0 can stop 2 units of type 0 and 1 unit of type 1\n\u003e\n\u003e 1 TOWER of type 1 can stop 1 unit of type 0 and 2 units of type 1\n\u003e\n\u003e TOWER 0 costs 3, TOWER 1 costs 4\n\u003e\n\u003e WAVE 0 bonus is 2, WAVE 1 bonus is 1\n\u003e \n\u003e WAVE 0 consists of 1 unit of type 0 and 1 unit of type 1\n\u003e\n\u003e WAVE 1 consists of 3 unit of type 0 and 3 units of type 1\n\n#### Output File\n\n```\n1 0\n0 2\n```\n\n\u003e WAVE 1: 1 tower of type 0 and 0 tower of type 1\n\u003e\n\u003e WAVE 2: 0 tower of type 0 and 2 towers of type 1\n\ntotal cost = 1 * 3 + 2 * 4 = 11 \u003c 12 (BUDGET)\n\nFirst wave:\n* units of type 0 stopped = 1 (number of towers of type 0) * 2 + 0 (number of towers of type 1) * 1 = 2\n* units of type 1 stopped = 1 (number of towers of type 0) * 1 + 0 (number of towers of type 1) * 2 = 1\n\nAll units were stopped, score = 1 + 1 (units stopped) + 2 (bonus) = 4\n\nSecond wave:\n\n* units of type 0 stopped = 2 (number of towers of type 0) * 2 + 2 (number of towers of type 1) * 1 = 2\n* units of type 1 stopped = 0 (number of towers of type 0) * 1 + 2 (number of towers of type 1) * 2 = 4\n\nscore = 2 + 3 (4 units of type 1 can be stopped but second wave only has 3 units of type 1) + 0 (no bonus since only 2 units of type 0 out of 3 were stopped) = 5\n\ntotal score = 4 + 5 = 9\n\n## Validate and Compute Score\n\nexample:\n\n```\ncargo run --release -- example/input_example.txt example/output_example.txt\n```\n\nexample output:\n\n```\nscore: 9\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpicojr%2Frustower","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpicojr%2Frustower","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpicojr%2Frustower/lists"}