OFFSIDE DEMONSTRATION APPLET
Instructions
-
Place the mouse pointer over a player (blue players are
attacking the goal at the top of the screen, reds defending)
and hold down the left mouse button
-
Drag the player into any position on the pitch you fancy.
Release the mouse button to drop the player in his current
location.
- Repeat with as many players as you like
-
Click the 'Check for Offside' button to see if play is offside
(were the ball to be played forward at that point)
-
The red line you will then see represents the 'offside threshold'
i.e. the point beyond which attacking players must not stray if
they are to stay onside
-
The applet will either inform you of the (most) offside player,
or describe the play as being onside, via a message on the yellow
panel at the top end of the pitch
-
You also have the facility to draw arbitray shapes over the scene,
a la Andy Gray on Sky Sports. To do this, click and drag the mouse
without selecting a player to move. You are the pundit!
-
If you are technically minded (or just curious, in all senses
of the word...) you can
see the Java source code here.
|
|
I wrote this applet following a conversation with a non-football savvy
friend, when I realised that the offside rule can seem complex when
explained verbally, but very simple when illustrated graphically.
According to the
official rules of Association Football, the offside rule is thus:
- A player is in an offside position if he is nearer to his opponent's
goal line than the ball is unless:
- he is in his own half of the field
- he is not nearer to his opponent's goal-line than at least two of his opponents
- A player will only be declared offside if, at the moment the ball
touches or is played by one of his own team, in the opinion of the
referee, that player is:
- interfering with the play or with an opponent, or
- seeking to gain an advantage by being in that position
- A player will not be declared offside:
- merely because of his being in an offside position, or
- if he receives the ball directly from a goal kick, corner kick, or throw-in
- If a player is declared offside, the referee gives an indirect
free kick which is taken by the opposing team from the place where
the offside occurred.Offside is judged from the moment the ball is
played. A player who is level with the second last opponent or with
the last two opponents is not in an offside position.
I thought this relatively simple set of rules would be good to express in
code - not too involved for an afternoon of programming, but enough of a
challenge to keep me interested for a few hours. If you want to see how
it was done you can see the
Java source code here.
Michael Fitzmaurice April, 2003