{"id":16818430,"url":"https://github.com/igr/hero-vs-monsters","last_synced_at":"2025-04-11T02:43:04.904Z","repository":{"id":189016866,"uuid":"679648564","full_name":"igr/hero-vs-monsters","owner":"igr","description":"Heros vs Monsters","archived":false,"fork":false,"pushed_at":"2024-04-08T05:23:36.000Z","size":211,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-25T00:38:06.207Z","etag":null,"topics":["showcase"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"igr","patreon":"igo_rs"}},"created_at":"2023-08-17T10:01:34.000Z","updated_at":"2023-08-28T22:19:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"f5ca0562-7b90-4a6f-bebb-a37f182f6fef","html_url":"https://github.com/igr/hero-vs-monsters","commit_stats":null,"previous_names":["igr/hero-vs-monsters"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igr%2Fhero-vs-monsters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igr%2Fhero-vs-monsters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igr%2Fhero-vs-monsters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igr%2Fhero-vs-monsters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igr","download_url":"https://codeload.github.com/igr/hero-vs-monsters/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248331266,"owners_count":21085868,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["showcase"],"created_at":"2024-10-13T10:50:06.801Z","updated_at":"2025-04-11T02:43:04.881Z","avatar_url":"https://github.com/igr.png","language":"Go","funding_links":["https://github.com/sponsors/igr","https://patreon.com/igo_rs"],"categories":[],"sub_categories":[],"readme":"# Hero vs Monsters\n\nThis repository contains the list of different solutions of the same problem, described below. Its goal is to showcase a variety of programming styles, languages, methodologies, and patterns, and to compare them.\n\nEach subfolder must be a complete solution, with its own build system. The only common part is the problem description.\n\nWhile this is a minor problem, feel free to express your ideas and demonstrate your principles. For example, if you have a separate module with only one file, that's perfectly acceptable here since our focus is to provide an illustrative example.\n\nYou are welcome to add more implementations, or enhance existing ones. It's perfectly fine to have multiple implementations in the same language, provided they're sufficiently distinct.\n\nWe encourage you to add as many comments to your code as possible to make it easier to understand. Our aim is to learn from each other and compare different approaches.\n\n## Implementations\n\n+ [Procedural Programming, Kotlin](pp-kotlin/README.md) by @igr\n+ [Object Oriented Programming, Java](simple-oop-java/README.md) by @igr\n+ [C# implementation](c-sharp-extensions/README.md) by @milosmisic\n+ [Go](go/README.md) by @mdelapenya\n+ [Typescript](typescript/README.md) by @jovanc\n\n## 🤴⚔️😈 The problem\n\n\nImplement gameplay for a simple RPG. In the game, there is the **hero**, our main character, and the **maze**, which acts as the game map.\n\nThe game map (maze) is a list of **rooms**. The hero moves from one room to another, never returning to a room he has already visited. There is always one exit from the room, the hero automatically proceeds through it.\n\nIn each room, there is a **monster** and an **item**. The hero begins his journey from the first room, battling a monster in each room along his path. Once a monster is defeated, the hero picks up an item in the same room to enhance himself.\n\nBoth heroes and monsters posses three attributes:\n\n+ attack damage,\n+ health, and\n+ speed.\n\nItems have the same attributes, used to enhance the hero, after the monster is defeated.\n\nMonsters have an another attribute:\n\n+ speed damage\n\nThe hero and monster take turns attacking each other. The `attack damage` indicates the amount of damage the hero or the monster will cause to their opponent (i.e., reducing their health) each turn. One is defeated once their health drops to `0` (or less). `Speed` determines which character attacks first (the one with a higher speed). `Speed damage` is the reduction in speed the hero will suffer if hit by the monster. The game is won when the last monster is defeated. Whenever the hero is defeated, it’s game over.\n\nSome monsters have the ability to clone themselves. This happens on the monster's turn when his health is less than `25%` of its initial health. The health is then split between the two. A monster can only clone itself once.\n\nMonster roars before the attack. Roar is constructed by concatenating random elements from the following set: \n+ single `H`, `W`, `L` letter.\n+ multiple (3-6, random) `R`, `O`, `A` letters.\n\nThe outcome of the game is deterministic, i.e., the same input always produces the same output. There is no randomization in the game flow.\n\n### Non-functional requirements\n\nThe maze with monsters is loaded from the input file `game.txt` that looks like this:\n\n```\n\u003cHero\u003e,\u003chealth\u003e,\u003cattack\u003e,\u003cspeed\u003e\n\u003cRoom A\u003e,\u003cMonster A\u003e,\u003chealth\u003e,\u003cattack\u003e,\u003cspeed\u003e,\u003cspeed damage\u003e,\u003cclonable\u003e,\u003cItem A\u003e,\u003chealth\u003e,\u003cattack\u003e,\u003cspeed\u003e\n\u003cRoom B\u003e,\u003cMonster B\u003e,\u003chealth\u003e,\u003cattack\u003e,\u003cspeed\u003e,\u003cspeed damage\u003e,\u003cclonable\u003e,\u003cItem B\u003e,\u003chealth\u003e,\u003cattack\u003e,\u003cspeed\u003e\n```\n\nThe whole battle should be televised :) Every move must be printed to the console. In the future, the console may be replaced with a different output system. What has to be printed:\n\n+ the moment hero enters the room,\n+ the monster's roar,\n+ the attack sequence between the hero and the monster,\n+ monster's cloning,\n+ the outcome of the battle,\n+ the moment hero picks up the item (if any)\n+ the final outcome of the game.\n\nTry to use name `Television` for the output system. Example output for the [game1.txt](game1.txt):\n\n```plaintext\nHero Beorn enters Hallway\nMonster Haunthand attacks: WHAAAAAARRROOOL\nHero Beorn fights Haunthand\nMonster Haunthand attacks: AAAWHLOOOOORRRR\nHero Beorn fights Haunthand\nMonster Haunthand is dead\nHero Beorn founds Sword\nHero Beorn enters Dark Room\nMonster Helltree attacks: RRRRRHLWOOOOOAAAAA\nHero Beorn fights Helltree\nMonster Helltree attacks: AAAHWOOORRRRRL\nHero Beorn fights Helltree\nMonster Helltree attacks: WRRROOOOOOHLAAAA\nHero Beorn fights Helltree\nMonster Helltree is dead\nHero Beorn founds Shield\nHero Beorn enters Tower\nMonster Red Dragon attacks: AAAAAHRRRRRLOOOOOOW\nHero Beorn fights Red Dragon\nMonster Red Dragon attacks: WAAAAAHOOORRRRL\nHero Beorn fights Red Dragon\nMonster Red Dragon attacks: RRRRROOOOOWLAAAAH\nHero Beorn fights Red Dragon\nMonster Red Dragon cloned!\nMonster Red Dragon attacks: RRRRRRLOOOOHWAAAAAA\nHero Beorn fights Red Dragon\nMonster Red Dragon is dead\nMonster Red Dragon clone attacks: WAAAAAHLRRRROOOO\nHero Beorn fights Red Dragon clone\nMonster Red Dragon clone is dead\nHero Beorn founds Gold\nHero Beorn wins!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figr%2Fhero-vs-monsters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figr%2Fhero-vs-monsters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figr%2Fhero-vs-monsters/lists"}