Skip to content

About

Solution to Jane Street's Robot Javelin puzzle (December 2024) - Solved using game theory optimization

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Jane Street Puzzle: Robot Javelin (December 2024)

Problem Statement

It's the Robot Javelin finals! Two robots compete:

  • Each throws a javelin, with distance drawn uniformly from [0, 1]
  • After the first throw, each robot decides to keep it or rethrow (must keep second throw)
  • The robot with larger final distance wins

The Twist: Spears Robot cheats by receiving a bit of information: whether Java-lin's first throw was above or below some threshold d of their choosing. Spears assumes Java-lin plays the Nash equilibrium strategy.

The Question: If Java-lin knows about the cheating and adjusts its strategy optimally, what is Java-lin's winning probability?

Solution

Key Insights

  1. Nash Equilibrium: In the fair game, both players use threshold t* = (√5 - 1)/2 ≈ 0.618 (the inverse golden ratio). Keep if first throw ≥ t*, rethrow otherwise.

  2. Spears' Optimal Cheating: Spears sets d = t* to perfectly distinguish Java-lin's keep/rethrow decision:

    • b=0 (X < t*): Java-lin rethrows → Spears uses threshold 1/2
    • b=1 (X ≥ t*): Java-lin keeps → Spears uses threshold (5-√5)/4 ≈ 0.691
  3. Java-lin's Counter-Strategy: Java-lin uses a lower threshold t_j = 7/12 ≈ 0.583:

    • When t_j ≤ X < t*: Java-lin keeps the throw, but Spears sees b=0 and incorrectly expects a rethrow
    • This mismatch allows Java-lin to exploit Spears' incorrect response

The Answer

Java-lin's optimal winning probability:

$$P(\text{Java-lin wins}) = \frac{229}{192} - \frac{5\sqrt{5}}{16} \approx 0.4939370904$$

Mathematical Derivation

For Java-lin using threshold t_j = 7/12:

  • Region 1 (X < 7/12): Java-lin rethrows, Spears sees b=0

    • Win rate: 3/8
    • Contribution: (7/12)(3/8) = 7/32
  • Region 2 (7/12 ≤ X < t*): Java-lin keeps, but Spears expects rethrow

    • Spears uses wrong threshold (1/2 instead of 0.691)
    • Win rate: 3x/2 - 1/2 for x ≥ 1/2
    • Contribution: (11 - 5√5)/8 + 7/192 = (271 - 120√5)/192
  • Region 3 (X ≥ t*): Java-lin keeps, Spears responds correctly

    • Split at Spears' threshold (5-√5)/4
    • Contribution: (-7 + 5√5)/16

Total: 7/32 + (271 - 120√5)/192 + (-7 + 5√5)/16 = 229/192 - 5√5/16

Files

  • final_solution.py - Complete symbolic solution with derivation
  • corrected_analysis.py - Numerical optimization and verification
  • solution.py - Initial exploration (superseded by final_solution.py)
  • monte_carlo.py - Monte Carlo simulation to verify the answer

Verification

Run the Monte Carlo simulation to verify:

python -m venv venv
source venv/bin/activate
pip install numpy scipy sympy
python monte_carlo.py

Answer

0.4939370904 (rounded to 10 decimal places)

Or in exact form: 229/192 - 5√5/16

About

Solution to Jane Street's Robot Javelin puzzle (December 2024) - Solved using game theory optimization

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages