Here is a short script I wrote in Python to simulate the airplane boarding process:
The script creates a randomly-ordered list of integers for the passengers (representing their ticket numbers) as well as a list of all the seats. The first passenger takes a random seat. After that, each subsequent passenger sits in their assigned seat if it's still available, and otherwise randomly takes one of the remaining seats.
After everyone's been seated, we check if the last passenger to board got his assigned seat, and if so increments the number of successes by 1. Each time the script runs it does many trials and returns the proportion of successes. I ran 100,000 trials, and the result was 0.5015, which agrees with the analytical solution provided in the previous post.