{"id":17099598,"url":"https://github.com/jbitton/hps-submarine-architecture","last_synced_at":"2026-05-01T08:30:59.607Z","repository":{"id":81695249,"uuid":"149907114","full_name":"jbitton/hps-submarine-architecture","owner":"jbitton","description":"architecture for submarine problem in heuristic problem solving","archived":false,"fork":false,"pushed_at":"2018-09-27T02:47:36.000Z","size":182,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-04T18:21:50.323Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CSS","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/jbitton.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,"publiccode":null,"codemeta":null}},"created_at":"2018-09-22T18:50:33.000Z","updated_at":"2021-06-17T15:50:43.000Z","dependencies_parsed_at":"2023-03-11T23:31:31.182Z","dependency_job_id":null,"html_url":"https://github.com/jbitton/hps-submarine-architecture","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jbitton/hps-submarine-architecture","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbitton%2Fhps-submarine-architecture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbitton%2Fhps-submarine-architecture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbitton%2Fhps-submarine-architecture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbitton%2Fhps-submarine-architecture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbitton","download_url":"https://codeload.github.com/jbitton/hps-submarine-architecture/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbitton%2Fhps-submarine-architecture/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32490809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-14T15:10:53.707Z","updated_at":"2026-05-01T08:30:59.589Z","avatar_url":"https://github.com/jbitton.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hps-submarine-architecture\n\nHello guys! This is the architecture for the submarine problem.\n\nThere are multiple parts to this project:\n* The Submarine Alert UI to go with the game\n* The actual server/client code that plays the game\n\n## Setup Client / Server Code\n\n1. This project uses `python3.6`. If you haven't already, please install it.\n2. Download dependencies: `pip install -r requirements.txt` \n3. `cd` into this project on your machine and run `python3.6 run_game.py`\n\nYou should see some output that looks similar to this:\n```\nsub {'m': 10, 'L': 4, 'pos': 78}\ntrench {'d': 36, 'y': 6, 'r': 6, 'm': 10, 'L': 4, 'p': 2}\nThe trench manager's final cost is: 120. The safety condition was satisfied.\nYour final cost is: 120. The safety condition was satisfied.\n```\n\nIf you do not, try to debug what's wrong on your side. If problems persist, please reach out.\n\n## Including Your Client Code\n\nUnder the `clients` folder you will find three files. You should only care about two of them:\n* `submarine_captain_client.py`: You will insert your submarine client code in the `your_algorithm()` function. You don't need to touch _anything else_. Follow the instructions detailed in the docstring.\n* `trench_manager_client.py`: You will split up your trench client code into two functions: `send_probes` and `choose_alert`. I split it up into two separate functions for modularity purposes and the fact that they do have different logic. You don't need to touch _anything else_. Follow the instructions detailed in each docstring.\n\n## Playing a Manual Game\n\nIn order to play a manual game (i.e., you enter in your moves every time using stdin), use the `--manual` flag. It has the following options:\n* `--manual both` you play the submarine captain and trench manager manually\n* `--manual sub` you play the submarine captain manually\n* `--manual trench` you play the trench manager manually\n\nSo, when you'd run the python code, you'd just run: `python3.6 run_game.py --manual both` for instance.\n\n## Modifying the Initial Game State\n\nIf you want to test out various initial game state values, you only need to modify one line of code.\n\nIn `run_game.py` on line 24, I initialize `controller = GameServer()`. To change the game state, inject any of the following parameters into `GameServer`: `d, y, r, m, L, p, and/or gui`.\n\n```\ncontroller = GameServer(d=45, y=10, r=50, m=3, L=10, p=3, gui=False)\n```\n\n## Running the Web Application\n\nOkay, so you want to see the awesome UI. It's stored under the `submarine-vis` folder. However, you do need to install some packages (it's written in `React.js`):\n\n1. Install `Node.js`: for Macs with homebrew installed, it's as easy as: `brew install node`. Or, you can visit the node website: https://nodejs.org/en/download/\n2. Install `yarn`: for Macs with homebrew installed, it's as easy as `brew install yarn`. Or, you can visit the yarn website: https://yarnpkg.com/lang/en/docs/install\n3. `cd` into `submarine-vis`\n4. Run `yarn install`. This will install all of the needed node dependencies\n5. Afterwards, run `yarn start` and the app should open up in a new tab. It's hosted on `localhost:3000`\n6. To have the GameServer provide an endpoint pass `True` to the gui optional parameter. ie. `GameServer(gui=True)`. This will provide an endpoint on `localhost:8000`\n\n**TIPS**:\nThe players will not be allowed to connect until the gui has connected to the GameServer. This means you should change your `run_server.py` to sleep for a longer amount of time prior to connecting to the game server.\n\nYou can independently open the gui in a browser by going to the address `localhost:8000`... assuming you're running the react app on your computer. You could also run both of your clients independently and connect to the game server after you connect the gui.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbitton%2Fhps-submarine-architecture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbitton%2Fhps-submarine-architecture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbitton%2Fhps-submarine-architecture/lists"}