This project simulates a primitive life form in a 2D environment with various obstacles and resources. The simulation uses reinforcement learning to control the PLF's behavior.
brain/: Backend server implementing the environment and RL algorithmsenvironment/: Frontend 3D visualization using Three.js
- Create a virtual environment and activate it:
cd brain
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the server:
cd src
python server.pyThe server will start on http://localhost:8000
- Install dependencies:
cd environment
npm install- Start the development server:
npm startThe frontend will be available at http://localhost:5173
- 3D visualization of the PLF and environment
- Different types of obstacles (radiation, scald, food)
- Health and energy system
- Reinforcement learning-based control
- Real-time visualization of PLF's state
GET /state: Get current state of the environmentPOST /step: Take a step in the environmentPOST /reset: Reset the environmentPOST /train: Train the RL model
- Green sphere: PLF
- Red spheres: Radiation obstacles
- Orange spheres: Scald obstacles
- Green spheres: Food resources
- Gray plane: Environment boundary