{"id":21730704,"url":"https://github.com/beepboopbit/laboratoryenvironment","last_synced_at":"2025-03-20T23:24:47.741Z","repository":{"id":232530655,"uuid":"784561489","full_name":"BeepBoopBit/LaboratoryEnvironment","owner":"BeepBoopBit","description":"A Simple Extensible Environment Library for simulation","archived":false,"fork":false,"pushed_at":"2024-05-09T05:21:04.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-25T20:11:21.478Z","etag":null,"topics":["library","simulation","student-project"],"latest_commit_sha":null,"homepage":"","language":"Python","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/BeepBoopBit.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":"2024-04-10T05:04:46.000Z","updated_at":"2024-05-09T05:21:08.000Z","dependencies_parsed_at":"2024-05-09T06:29:40.979Z","dependency_job_id":"ffcd8ccc-6227-4efa-9ea3-a90fe485f608","html_url":"https://github.com/BeepBoopBit/LaboratoryEnvironment","commit_stats":null,"previous_names":["beepboopbit/laboratoryenvironment"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeepBoopBit%2FLaboratoryEnvironment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeepBoopBit%2FLaboratoryEnvironment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeepBoopBit%2FLaboratoryEnvironment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeepBoopBit%2FLaboratoryEnvironment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BeepBoopBit","download_url":"https://codeload.github.com/BeepBoopBit/LaboratoryEnvironment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244707718,"owners_count":20496789,"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":["library","simulation","student-project"],"created_at":"2024-11-26T04:17:06.295Z","updated_at":"2025-03-20T23:24:47.722Z","avatar_url":"https://github.com/BeepBoopBit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laboratory Environment\n\nA Simple Extensible Environmenet Library for Simulation. (Student Project)\n\n## Classes\n\n### Environment\n\nAn environment abstracts all of the classes and provides interfaces for\neasier interaction\n\n\u003e Note: This is not an abstract class, but you can override functions if you want to.\n\u003e Note: You can use this library to simulate even non-metal entities. For now I just used metal to create the proof of concept.\n\n### Example Code\n\n```py\nfrom lib.Behavior import *\nfrom lib.LaboratoryEnvironment import *\nfrom lib.Metals import *\nfrom lib.Reaction import *\n\nclass WaterPHChanging(Behavior):\n    def trigger(self):\n        # Add +-0.75 to the 'ph' value of the metal every epoch\n        import random\n        value = random.uniform(-0.75, 0.75)\n        self.env.metal.parameters['ph'].run('add', value)\n\nclass WaterReactionToPH(Reaction):\n    def react(self, _metal):\n        # Get the ph value of the metal\n        ph_value = _metal.parameters['ph'].value\n\n        # Check for Conditions\n        if  ph_value \u003c= -1:\n            print(\"[!] Water is moving toward being acidic\")\n        if ph_value \u003e= 1:\n            print(\"[!] Water is moving toward being a base\")\n        if ph_value \u003e -1 and ph_value \u003c 1:\n            print(\"[!] Water is Nuetral\")\n\n# Create the metal with the 'ph' parameter\n_metal = Metal({\n    \"ph\": EntityParameter(0, WaterReactionToPH())\n})\n\n# Create the behavior container\n_behaviors = Behaviors()\n\n# Add the behavior we've created\n_behaviors.add(\"Ph_Change\",WaterPHChanging())\n\n# Create the environment with not environmental parameters\n_env = LaboratoryEnvironment( {}, _metal, _behaviors, _verbose=1)\n_env.compile()\n_env.simulate(15)\n```\n\n\n### Behaviors\n\nA Behavior specifies how an environment should change a parameter.\n\n- Behaviors\n    - Container of Behaviors\n- Behaior\n    - Specifiy the Behavior of the Environment\n    - Requires the `trigger()` method\n\n#### Example Usage\n\n```py\nclass MyBehavior(Behavior):\n    def trigger(self):\n        # ... some code here ...\n\nclass MyOtherBehavior(Behavior):\n    def trigger(self):\n        # ... some code here ...\n\n_behaviors = Behaviors()\n_behaviors.add(\"BehaviorName\", MyBehavior())\n_behaviors.add(\"OtherBehaviorName\", MyOtherBehavior())\n```\n\n\n### Parameters\n\nA parameter is an abstracted value that contains methods for environment\ninteraction.\n\n- EntityParameter\n    - Specify a parameter that reacts on certain parameter changes\n\n### Example Usage\n\n```py\nclass MyReaction(Reaction):\n    def react(self, _metal):\n        #my code here\n\nsome_value = 10\n_metal = Metal({\n    \"ParameterName\": EntityParameter(some_value, MyReaction())\n})\n```\n\n### Reactions\n\nA Reaction specify how a parameter reacts base on certain conditions.\n\n- Reaction\n    - Requires `react()` method\n\n\u003e Example Usage: [Parameters](###Parameters)\n\n### Metal\n\nA Metal is an abstraction of an object that you want to simulate\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeepboopbit%2Flaboratoryenvironment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeepboopbit%2Flaboratoryenvironment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeepboopbit%2Flaboratoryenvironment/lists"}