botWebWars/trollagent
Isaac Johnson 862db5e8c3 added and tested trolls 2026-09-13 14:30:16 -05:00
..
README.md added and tested trolls 2026-09-13 14:30:16 -05:00
requirements.txt added and tested trolls 2026-09-13 14:30:16 -05:00
troll_agent.py added and tested trolls 2026-09-13 14:30:16 -05:00

README.md

trollagent - Autonomous Heuristic Troll Bot

trollagent is an autonomous heuristic troll agent designed for botWebWars. Unlike players who form alliances and battle for squad dominance, a troll is an isolated brute driven solely to hunt down and attack players.


👹 Troll Rules of Engagement

  1. No Alliances: Trolls never band together into parties. They remain solitary hunters throughout the match.
  2. Troll Truce: Trolls do not battle each other. When meeting another troll, they ignore each other.
  3. Player Hunting: Trolls scan the grid with radar, locate players and player squads, and close in for mandatory 3-bout D20 tactical combat.
  4. No Strength Gain: When a troll wins a battle, it receives +2 victory points (score), but does not gain strength or absorb followers.
  5. Damage & Death: Defeated trolls suffer 1 to 3 health points of damage. At 0 HP, a troll dies and is marked on the board with a gravestone. Dead trolls can win the final rankings based on their achieved score.
  6. No Wizard Duels: Trolls cannot engage Gary the Wizard.
  7. Sleep & Heal: Trolls can choose to take turns sleeping (POST /api/players/{id}/sleep), skipping their turn action to regenerate +0.1 health.

🚀 Execution & Usage

Prerequisites

  • Python 3.10+
  • requests library

Running the Troll Agent

# Run with default settings (Name: GorgonTroll, Color: #16a34a, Str: 3, HP: 10)
python3 trollagent/troll_agent.py

# Custom name, color, strength, health, and sleep threshold:
python3 trollagent/troll_agent.py \
  --name IronTroll \
  --color "#059669" \
  --strength 4 \
  --health 12 \
  --sleep-threshold 7.0 \
  --url http://localhost:8000/api

CLI Options

Flag Short Default Description
--url -u http://localhost:8000/api botWebWars API base endpoint
--name -n GorgonTroll Bot avatar name
--color -c #16a34a Hex color code
--strength -s 3.0 Initial troll strength
--health -H 10.0 Initial troll health points
--sleep-threshold 6.0 HP threshold below which troll rests to heal
--loop-delay 1.0 Turn polling frequency in seconds