Skip to content

loonailove/robot-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TerraBot - Robot Simulation Engine

Project Description

This project implements an autonomous robot simulation named TerraBot. The system manages a complex ecosystem where the robot interacts with various entities (Air, Water, Soil, Plants, and Animals) to monitor and improve environmental conditions.

Implementation Details

Core Components

  • TerraBot (Singleton): The main actor of the simulation. It maintains its battery level, current coordinates, an Inventory of scanned items, and a KnowledgeBase for learned facts.
  • SimulationManager: Orchestrates the simulation flow. It handles the runSimulation loop, processes commands via a factory, and ensures the environment updates chronologically.
  • EnvironmentUpdater: Manages the "physics" of the world. It calculates plant growth, oxygen production, humidity changes, and animal movement/eating habits based on whether the robot has scanned the relevant entities.
  • Command Pattern: All actions (moving, scanning, recharging) are decoupled into command objects created by the CommandFactory.

Key Logic

  • Energy Management: The robot consumes energy for actions and can enter a recharge state, during which a chargingTimeRemaining timer must expire before it becomes active again.
  • Environmental Cycles: Every iteration, the EnvironmentUpdater refreshes the map. For example, if a Plant and Water are both scanned, the plant's maturity increases.
  • Knowledge Acquisition: Through ScanObject and LearnFact, the robot populates its Inventory and KnowledgeBase to unlock further interactions with the environment.

About

object oriented programming project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages