To determine which players are offside at a given time an algorithm is run to firstly find the second last
defender and then compare every player from the attacking team against this reference. Players are identified by
their jersey numbers and by their team. The reference is created using a bubble method in which the largest of a
series of values rises to the top. The second largest is then taken for comparison. Each player from the attacking
team is compared against the defending team’s reference. Those players who exceed the reference position have
their jersey number added to an array. Once all players have been compared, the jersey numbers of offside players
are sent as a wireless data packet back to the referee’s watch to be displayed on the LCD monitor.