# Build a High-Performance Autonomous Slither.io Bot ## Pro...
Prompt
# Build a High-Performance Autonomous Slither.io Bot ## Project objective Build a fully autonomous Slither.io AI bot from scratch. The bot must independently play Slither.io, collect food, grow, survive, hunt opponents, execute tactical attacks, and escape dangerous situations. The goal is to create a genuinely intelligent player capable of long-term survival and aggressive competitive gameplay. This is a new implementation. Do not simply recreate an existing bot's source code or copy its architecture. However, the feature inventory below describes capabilities from a previous Slither.io bot that should be considered when designing the new implementation. # PART 1: Core gameplay ## 1. Autonomous movement - Independently control the snake. - Smoothly adjust heading. - Avoid unnecessary circles and repetitive movement. - Predict obstacles and other snakes. - Maintain efficient movement toward objectives. - Avoid getting trapped against the arena boundary. ## 2. Intelligent food collection Implement a proper food-seeking system. Features: - Detect nearby food. - Calculate food value relative to collection distance. - Identify valuable food clusters. - Prioritize high-value opportunities. - Track food collection progress. - Abandon inaccessible or unproductive food targets. - Avoid repeatedly targeting the same blocked food. - Recognize the valuable food dropped by eliminated snakes. - Temporarily prioritize large food opportunities after deaths. - Use boosts for valuable food collection when worthwhile. The bot should not simply chase the closest food. ## 3. Intelligent hunting Create an opponent evaluation system. Analyze: - Opponent distance. - Relative snake length. - Movement direction. - Current speed. - Predicted trajectory. - Boost status. - Turning behavior. - Available escape corridors. - Potential interception time. - Whether attacking is realistically profitable. Do not restrict hunting to smaller snakes. Larger opponents should also be considered when a safe tactical opportunity exists. Maintain target commitments so the bot does not constantly switch between opponents. # PART 2: Advanced combat Implement multiple attack methods. ### A. FLANK APPROACH Approach an opponent from an advantageous angle. Position the player to prepare for a more decisive attack rather than blindly chasing the opponent's head. ### B. BODY CUT-OFF Predict where an opponent will travel and establish a safe crossing position ahead of it. Use the player's body to restrict the opponent's movement. ### C. BOOSTED CUT-OFF Use a calculated boost to reach a crossing point that would otherwise be unreachable in time. ### D. ENCIRCLEMENT Attempt to orbit and gradually restrict an opponent's available movement. Evaluate: - Orbit radius. - Entry angle. - Opponent movement. - Available escape corridors. - Future confinement. - Third-party threats. - Escape routes for the player. Do not attempt an encirclement unless its route is actually feasible. Do not automatically exclude larger opponents. ### E. BODY TRAP Use the player's existing body to exploit an opponent's predicted collision. An opponent moving toward the player's existing body can represent an offensive opportunity rather than simply a defensive emergency. ### F. TRAIL TRAP Predict where the player's future body trail will extend. Determine whether an opponent will intersect that trail after the player's head passes. The attack planner should independently validate these opportunities before committing. # PART 3: Predictive AI This must be one of the strongest systems in the bot. ## 4. Enemy trajectory prediction Track enemy movement over time. Estimate: - Velocity. - Acceleration where measurable. - Turn rate. - Direction. - Boost activation. - Likely future heading. - Potential interception points. Evaluate multiple plausible movement trajectories rather than assuming every opponent travels in a straight line. Enemy boost predictions must account for finite boost durations. ## 5. Collision prediction Predict collisions involving: - Enemy heads and the player's head. - Enemy heads and the player's existing body. - Enemy heads and the future body trail of the player's planned movement. - Enemy body segments entering the player's path. - Other nearby snakes. - Arena boundaries. Account for the time delay between the player's head moving and its body following. Use the same geometric collision calculations for defensive and offensive decisions. ## 6. Future escape-space prediction Estimate the amount of space available after following a proposed route. Determine: - Number of available escape corridors. - Closest obstacles. - Future clearance. - Whether the player will become enclosed. - Whether a route creates a dangerous dead end. Reject routes that leave the player without viable escape options. # PART 4: Defense and emergency behavior ## 7. Threat assessment Distinguish between: - Nearby neutral snakes. - Snakes approaching the player's travel path. - Confirmed incoming head attacks. - Enemy bodies moving into the player's lane. - Genuine enclosure threats. - Imminent collisions. Do not classify every nearby snake as an attacker. Emergency behavior must require credible evidence of actual danger. ## 8. Emergency escape Implement several escape strategies: - Direct escape. - Lateral escape. - Movement around enemy body segments. - Body-relative breakout routes. - Circular breakout when appropriate. - Pincer escape. - Emergency boost. The bot should calculate and execute the exact escape trajectory selected by its planner. It must be able to escape large-body enclosures even when the player's snake is relatively short. ## 9. Combat re-entry After escaping: - Remember which direction was used. - Remember the attacker. - Avoid immediately re-entering the same dangerous lane. - Reassess the opponent's position. - Re-engage the previous target when safe. - Preserve the original attack commitment when appropriate. A defensive interruption should not permanently destroy the bot's existing tactical plan. # PART 5: Tactical memory and decision-making ## 10. Persistent target selection Remember current targets and attack plans. Avoid unnecessary target switching. Switch targets when: - The current target becomes unreachable. - The attack is no longer viable. - The target dies or disappears. - A substantially better opportunity becomes available. - The current pursuit stops making meaningful progress. ## 11. Pursuit watchdog Track whether an attack is actually succeeding. Measure: - Interception-time improvement. - Actual distance reduction. - Progress toward the selected attack position. - Whether the target remains reachable. Abandon stalled attacks rather than pursuing indefinitely. ## 12. Failed strategy memory Remember which attack methods have failed against individual opponents. Temporarily penalize repeated failures when scoring new tactics. Do not permanently disable an attack method. A previously unsuccessful tactic may become valid when circumstances change. Reset failure penalties when genuine progress occurs. ## 13. Strategic objective selection The bot should continuously evaluate three primary objectives: 1. SURVIVAL 2. FOOD 3. HUNT Immediate survival takes priority. When safe, compare the value and expected reward of collecting food versus attacking opponents. Avoid switching objectives every frame. Use reasonable commitment and hysteresis. # PART 6: Boost management ## 14. Intelligent boost scheduling Support separate boost purposes: - Normal boost. - Attack boost. - Emergency boost. - Food-collection boost. - Enclosure-breakout boost. Consider: - Current length. - Expected time saved. - Remaining reserve. - Collision risk. - Target interception timing. - Cooldowns. Shorter snakes must still be capable of emergency escapes. Never blindly boost toward an opponent or obstacle. # PART 7: Interface and visualization ## 15. Control panel Build a clean floating dashboard. Include: **Main controls** - Start/stop bot. - Balanced preset. - Aggressive preset. - Defensive preset. - Farmer preset. **Adjustable settings** - Food priority. - Hunt aggression. - Safety and spacing. - Automatic boost. - Encirclement. - Defensive response. - Arena-border avoidance. **Visual controls** - Show planned route. - Mark current target. - Display threat rings. - Show predicted enemy trajectories. - Show border safety zones. Settings must persist across reloads. The dashboard should be draggable and collapsible. ## 16. Visual tactical overlay Draw useful information over the actual game: - Planned movement route. - Current target. - Food target. - Escape waypoint. - Enemy threat zones. - Enemy predicted trajectories. - Boosting opponents. - Projected parallel body movement. - Arena safety boundary. - Encirclement zones. Keep the overlay smooth and visually uncluttered. # PART 8: Diagnostics and match analysis ## 17. Decision logging Provide a detailed decision log. Record: - Target selections. - Target changes. - Attack method selection. - Attack commitments. - Failed attacks. - Attack interruptions. - Defensive overrides. - Emergency escapes. - Boost decisions. - Objective changes. - Reasons for rejecting tactical opportunities. Include copy and clear controls. Persist useful logs locally. ## 18. Match summaries Track: - Survival duration. - Kills. - Peak snake length. - Final snake length. - Best rank. - Final rank. - Maximum lobby population. - Time spent boosting. - Time spent attacking. - Time spent defending. - Number of attack plans. - Attack methods used. - Number of food/loot runs. - Likely cause of death. - Final AI state. - Recent decision history. Clearly distinguish confirmed events from inferred death causes. # PART 9: Technical implementation Build a standalone Tampermonkey userscript. Support: - https://slither.io/* - https://slither.com/io* Requirements: - JavaScript. - No paid APIs. - No backend requirement. - No unnecessary dependencies. - Reliable game-state detection. - Safe initialization and cleanup. - Local settings persistence. - Robust handling of missing game objects. - Efficient movement and trajectory calculations. - Responsive dashboard. - Manual takeover at all times. Organize the implementation into logical systems: 1. Game-state observation. 2. Motion tracking. 3. Trajectory prediction. 4. Threat assessment. 5. Food evaluation. 6. Opponent evaluation. 7. Attack planning. 8. Route validation. 9. Emergency planning. 10. Steering and boost control. 11. Dashboard and diagnostics. **Critical architecture rule:** The attack planner must never bypass the collision-validated movement planner. Offensive plans select destinations. The movement controller independently validates the actual trajectory before execution. # PART 10: Testing and quality assurance Create a deterministic offline simulation environment. Test: - Food collection. - Food clusters. - Dead-snake loot collection. - Opponent tracking. - Moving interception. - Larger opponent hunting. - Flank attacks. - Body cut-offs. - Encirclement. - Body traps. - Trail traps. - Collision prediction. - Enemy boost prediction. - Pincer escape. - Large-body enclosure breakouts. - Short-snake emergency boosting. - Target commitments. - Failed attack memory. - Pursuit abandonment. - Combat re-entry. - Wall avoidance. - Missing game-state handling. Run tests after every major implementation change. Also test the actual userscript in live gameplay. Offline tests alone are not sufficient evidence of good gameplay. # FINAL REQUIREMENTS Deliver: 1. Complete working userscript. 2. Automated regression tests. 3. Installation instructions. 4. Technical architecture documentation. 5. Testing results. 6. Known limitations. Do not stop at planning, documentation, or pseudocode. Actually build the bot. Prioritize intelligent gameplay, survival, and successful combat over elaborate UI or unnecessary architectural complexity. The finished bot should feel like an independent Slither.io player capable of farming, hunting, defending, and making sophisticated tactical decisions without human intervention.
Response not available
Response not available