AI Decision Visualizer

See how Tactiko's heuristic AI scores every grid position. Place players on the pitch, then watch the heatmap reveal what the AI "thinks" is the best move.

Placement Tool
Your Goal
-6.0
0,3
-4.0
1,3
9.0
2,3
9.0
3,3
9.0
4,3
-4.0
5,3
-6.0
0,2
-4.0
1,2
11.6
2,2
13.0
3,2
*
9.0
4,2
-4.0
5,2
-6.0
0,1
-4.0
1,1
9.0
2,1
9.0
3,1
9.0
4,1
-4.0
5,1
-21.0
0,0
-19.0
1,0
-19.0
2,0
-19.0
3,0
-19.0
4,0
-19.0
5,0
Midfield
AttackerDefenderKeeperBall
Scoring Factors
Bot Personality
Defense Depth0.50
Park the BusHigh Press
Forward Bias0.50
ConservativeUltra Aggressive
Hold Willingness0.30
Always MoveHold Position
Randomness0.30
DeterministicVery Random
Best Cell: (3, 2) — Score 13.0
manMarking: +13.0

How the Heuristic AI Works

Defensive AI

The defensive AI uses a man-marking system where each defender is assigned to the closest attacker via greedy matching. For each possible move (the 8 adjacent cells + staying put), the AI calculates a composite score based on multiple factors:

  • Defensive Zone — Heavy penalty for venturing beyond the defensive line (controlled by defenseDepth personality).
  • Man-Marking — Score based on distance to the assigned attacker. The AI anticipates forward movement, covering where the attacker will be, not just where they are now.
  • Goal-Side Positioning — Bonus for staying between the attacker and the goal. Being behind the line of the ball is always preferred.
  • Ball Pressure — When your assigned man doesn't have the ball and is far from danger, defenders can help press the ball carrier.
  • High-Value Zone — Extra protection for central cells in rows 2-3 (the "75% scoring zone" where shots have the highest success rate).
  • Collision Avoidance — Massive penalty (-100) for overlapping with another defender. No stacking allowed.

Attacking AI

Attacking teammates (non-ball-carriers) choose positions to maximize their chance of receiving the ball and scoring. The scoring system evaluates:

  • Forward Push — Strong bias toward advancing into the shooting zone (rows 2-3). Controlled by forwardBias personality.
  • Defender Freedom — Huge bonus (+25) for reaching cells that no defender can contest. Being "truly free" in the shooting zone almost guarantees a shot next turn.
  • Pass Lanes — Bonus for positions with a clear passing lane from the ball carrier (no defenders blocking the path).
  • Width — Reward for spreading out from the ball carrier to stretch the defensive line.
  • Hold Position — When already in a good spot (free from defenders, in the shooting zone), the AI prefers to hold rather than move.

Personality Parameters

Each bot in Tactiko has a unique personality that adjusts the weight of these scoring factors. The four main dials are:

  • Defense Depth — 0.0 parks the bus (defenders never leave rows 2-3), 1.0 enables a high press into midfield.
  • Forward Bias — Controls how aggressively attackers rush forward vs. holding position.
  • Hold Willingness — Higher values make the AI prefer staying in a good position rather than constantly moving.
  • Randomness — At 0.0, the AI always picks the highest-scoring move. At 1.0, there's significant chance of picking suboptimal moves (creating unpredictability).

What Makes a Good Defensive Position?

The best defensive cells share these properties: they're goal-side of the assigned attacker, within Chebyshev distance 1 (i.e., one move away), inside the shooting zone (rows 2-3), and not overlapping with another defender. The ideal is to be on the anticipated position of your man, which blocks their advance and contests any shot attempt.

The "anticipation" mechanic is crucial: defenders don't just react to where attackers are now — they predict the attacker will move one row forward and position accordingly. This is why you sometimes see AI defenders appear to "retreat" even when the attacker hasn't moved yet.

How Personality Changes Behavior

Try adjusting the sliders above to see the effect. A "park the bus" defense (depth = 0.0) creates a wall in rows 2-3 but leaves midfield open. A high press (depth = 1.0) can intercept passes early but risks leaving gaps behind. High forward bias on attack makes explosive runs but can leave attackers offside (too far forward). High randomness makes the AI unpredictable — sometimes brilliantly creative, sometimes making bizarre moves.

This is the same AI you play against in Tactiko. Can you outsmart the heuristics now that you've seen how they work?

Play Tactiko