jai_alai_simulation, a Python code which simulates the outcome of a jai-alai match.

Eight players participate in the match. The first game involves players 1 and 2. The loser goes to the end of the line of players, the winner scores a point. The next game involves the winner of the previous game and the next player in line. After seven points have been scored, each win now is worth 2 points. The match terminates when 7 points have have been scored.

The code can simulate a single match, or a tournament of n matches. The interesting question is to observe how the placement of a player in the initial lineup affects their chance of winning the match. Assuming the players have equal strengths, there is a clear bias in favor of the players at the head of the line.


The computer code and data files described and made available on this web page are distributed under the MIT license


jai_alai_simulation is available in a MATLAB version and an Octave version and a Python version.

Related Data and codes:


python_simulation, a Python code which uses simulation to study card games, contests, and other processes which have a random element. Usually, the purpose is to try to predict the average behavior of the system over many trials.


  1. Steven Skiena,
    Calculated Bets,
    Computers, Gambling, and Mathematical Modeling to Win, Cambridge University Press, 2001,
    ISBN13: 978-0521009621.

Source Code:

Last revised on 16 November 2022.