# Ant Colony Simulation URL Parameter Examples

The ant colony simulation now supports URL parameters to share and reproduce specific configurations. Here are example URLs demonstrating different settings:

## Basic Examples

### Simple Colony (Few Ants, Fast Evolution)
```
ants-modular.html?targetPopulation=100&evapRate=0.995&speed=0.2
```

### Large Colony (High Population, Slow Pheromones)  
```
ants-modular.html?targetPopulation=2000&evapRate=0.9998&diffusionRate=0.05
```

### Fast Exploration (High Speed, Wide Angles)
```
ants-modular.html?speed=0.3&wiggleAngle=45&turnStrength=0.1&burdenRate=0.5
```

### Visualization Mode (Field Visualization Only)
```
ants-modular.html?showAnts=false&fieldViz=3&showSourceSink=true
```

## Environment Examples

### Spiral Maze Configuration
```
ants-modular.html?wallType=3&nestType=1&foodType=0&targetPopulation=800
```

### Four Corner Food Sources
```
ants-modular.html?wallType=0&nestType=0&foodType=1&showSourceSink=true
```

### Complex Maze with Bars
```
ants-modular.html?wallType=2&nestType=1&foodType=1&targetPopulation=1500&speed=0.05
```

## Advanced Configurations

### High Pheromone Sensitivity
```
ants-modular.html?turnStrength=0.15&avoidStrength=0.05&evapRate=0.9995&diffusionRate=0.1
```

### Trail-Heavy Visualization
```
ants-modular.html?trails=true&trailsLambda=0.05&showAnts=false&fieldViz=2
```

### Scientific Study Mode (No Visuals, Pure Behavior)
```
ants-modular.html?showAnts=false&trails=false&showSourceSink=false&fieldViz=0&targetPopulation=3000
```

### Debug Mode (All Visualizations)
```
ants-modular.html?showAnts=true&trails=true&showSourceSink=true&fieldViz=1&trailsLambda=0.3
```

## Specialized Behaviors

### Forager Specialists (Low Burden, High Speed)
```
ants-modular.html?burdenRate=0.3&speed=0.25&turnStrength=0.05&wiggleAngle=5
```

### Explorer Mode (High Randomness)
```
ants-modular.html?wiggleAngle=30&turnStrength=0.01&avoidStrength=0.001&speed=0.15
```

### Efficient Colony (Balanced Parameters)  
```
ants-modular.html?targetPopulation=1000&speed=0.12&turnStrength=0.03&burdenRate=0.8&evapRate=0.999
```

## Parameter Reference

### Boolean Parameters (true/false)
- `nestMouse` - Mouse draws nest pheromones vs food pheromones (default: true)
- `showAnts` - Display ant agents (default: true)
- `trails` - Show ant movement trails (default: true)
- `showSourceSink` - Show food sources, nests, and walls (default: true)

### Numeric Parameters

#### Population & Performance
- `targetPopulation` - Number of ants (0-1000000, default: 500)

#### Visual Settings
- `trailsLambda` - Trail decay rate (0-0.5, default: 0.2)
- `fieldViz` - Visualization mode (0=none, 1=combined, 2=sobel, 3=pheromones, default: 2)

#### Pheromone Physics
- `evapRate` - Pheromone evaporation rate (0.996-1.0, default: 0.999)
- `diffusionRate` - Pheromone spread rate (0-0.125, default: 0.125)
- `numPheromone` - Max pheromone capacity per ant (varies by screen size)

#### Ant Behavior
- `speed` - Ant movement speed (0-2, default: 0.1)
- `wiggleAngle` - Random movement angle in degrees (0-90, default: 10.0)
- `turnStrength` - How strongly ants follow pheromone gradients (0-0.5, default: 0.02)
- `avoidStrength` - How strongly ants avoid wrong pheromone type (0-0.5, default: 0.01)
- `burdenRate` - Speed reduction when carrying food (0-1, default: 1.0)

#### Environment Configuration
- `wallType` - Wall pattern (0=none, 1=narrowBars, 2=fullBars, 3=spiral, default: 0)
- `nestType` - Nest layout (0=threeNests, 1=centerNest, default: 0)
- `foodType` - Food placement (0=bigCircle, 1=fourCorners, default: 0)

## Usage Notes

1. **Parameters only appear in URLs when they differ from defaults** - keeps URLs clean
2. **URL updates automatically** when you change settings via keyboard or GUI
3. **Share URLs** to reproduce specific ant colony behaviors
4. **Bookmark URLs** to save interesting configurations
5. **Parameters are loaded on page initialization** before simulation starts

## Keyboard Controls Still Work

All keyboard controls function as before and update the URL automatically:
- `f` - Toggle nest/food pheromone mouse mode
- `F` - Cycle field visualization modes
- `a` - Toggle ant visibility  
- `s` - Toggle source/sink visibility
- `t` - Toggle trails
- `x` - Clear pheromones (temporary action)
- `r` - Randomize ant positions (temporary action)

## GUI Controls Integration

All dat.GUI slider and dropdown controls automatically update the URL when changed, making it easy to experiment with parameters and share the results.

## Example Use Cases

### Research & Education
- **Behavior Studies**: `?turnStrength=0.1&avoidStrength=0.02&targetPopulation=500`
- **Visualization Demo**: `?trails=true&trailsLambda=0.1&fieldViz=1&showSourceSink=true`
- **Performance Testing**: `?targetPopulation=5000&showAnts=false&trails=false`

### Creative & Artistic
- **Aesthetic Trails**: `?trails=true&trailsLambda=0.05&showAnts=false&fieldViz=2`
- **Complex Mazes**: `?wallType=3&targetPopulation=2000&speed=0.05`
- **Dynamic Patterns**: `?diffusionRate=0.1&evapRate=0.995&wiggleAngle=20`

The URL parameter system makes the ant colony simulation fully shareable and reproducible for scientific, educational, and creative purposes!