```WHAT IS IT?
-----------
"In rugby, after a try has been scored, the scoring team has
the opportunity to gain further points by 'kicking a
conversion'. The kick can be taken from anywhere on an
imaginary line that is perpendicular to the try line (i.e the goal
line) and goes through the location on the try line where the try was
scored. Where should the kick be taken from to maximize the chance of
a score?"

This problem, taken from a British mathematics textbook, was the
inspiration for this model. The problem and its StarLogoT solution
is described in greater detail in Wilensky's "Modeling Rugby:
Kick First Generalize Later?" published in the International
Journal of Computers for Mathematical Learning, vol 1 no. 1.

Instead of trying to solve it with calculus or
geometry, we'll take a probabilistic approach and use StarLogo
turtles and patches. Essentially, we'll have a player stand on
each patch along the imaginary kick line (the vertical yellow line),
and kick thousands of balls in random directions.
Players receive one 'point' for each conversion they score.
The idea is that since each kick-angle is randomly chosen,
those players who score the most points must be standing in the
best positions.

Note that this approach is quite different from the analytic
approach. In the standard mathematical solution, one is expected
to equate best chance of scoring with maximal angle from the kick
line to the goal. In the probabilistic solution, this is not
assumed. It emerges as the result if the playing field is assumed
to be uniform. If, however, the model is extended to include wind
or grass grain or decaying kick speeds, this solution adjusts
gracefully in contrast to the brittle analytic solution.

For a fuller account, see Wilensky, U. (1996). Modeling Rugby: Kick
First , Generalize Later? International Journal of Computers for
Mathematical Learning. Vol. 1,  No. 1. p. 124 - 131.
http://www.tufts.edu:80/~uwilensk/papers/rugby/rugby.html

HOW TO USE IT
-------------
There are two main parts to 'rugby'. First, we have the sequence of
rounds during which we find the best positions for kicking goals
using the procedure described above. Second, we have a set of
controls for drawing the level-curves associated with the given
goal-size. These additional controls allow us to visualize the
field of solutions for the analytic case of uniform field.

We use four sliders to initialize 'rugby'.
-GOAL-SIZE determines the size of the goal.
-GOAL-POS is the x-coordinate of the left goal-post. It is
placed GOAL-POS units away from the leftmost screen-edge.
-Hence the left goal-post is at (0 - screen-edge + GOAL-POS,
screen-edge), and the right goal-post is at (0 - screen-edge +
GOAL-POS + GOAL-SIZE, screen-edge).
-PERP-LINE determines the x-coordinate of the kick-line. The kick
line is PERP-LINE units away from the leftmost screen-edge.
-Note that the values of PERP-LINE, GOAL-SIZE, and GOAL-POS may
-NUMBER is the number of balls that will be kicked in a
single round.

Press the SETUP button to initialize the model, after you've
chosen appropriate values for the sliders. When you're ready
to run it, press the GO forever-button. This will commence the
kicking; rounds will be repeated and results accumulated until
you press the ENOUGH button. ENOUGH will turn off the GO button,
and prepare a final report of results and compare them to an analytic
solution, in the Output Window.

Watch the left-hand side of the screen as the model runs. A
histogram is being plotted of total points scored from each
position along the kick line. The best scores (to date) for each round
are highlighted in pink -- the others are drawn in blue.

You can also graphically view the level-curves (the curves of constant
viewing angle, i.e. the curve along which the goal appears to be the
same size. From straight ahead, the goal appears maximally wide. From
a shallow angle, the goal looks smaller at the same distance from the
try line) associated with the viewing angle of the goal for each
patch. The two sliders ANGLE1 and ANGLE2 determine the bounds of the
viewing angle (the angular size) you'd like to see level curves for;
the DRAW-LEVEL-CURVES button will then draw these curves.

The CURRENT-MAX monitor shows the number of goals scored by the best
"patch", (i.e the best position on the kick-line)

The BEST-DIST monitor shows the distance to the try line for the best
kicking position (to date).

THINGS TO NOTICE
----------------
Given a particular goal-line and kick-line, what are the
best positions to kick from? First try running the model
with PERP-LINE of 10, GOAL-SIZE as 25, GOAL-POS as 50, and
NUMBER as 1000. Change the position and size of the goal.
How do the 'best positions' change in relation to the goal's
position? Then change the position of the kick line, and
redo all trials. How does the performance compare when the
kick line is farther away? Or closer?

Examine the histogram at the left edge of the screen. What do you
notice about it? What shape does it have? What does it tell you
about the best locations to kick from?

THINGS TO TRY
-------------
Can you generalize the results given by 'rugby'? What are
the relationships between the kick-line, the goal, and the
best patch to kick from?

Re-read the problem description given in the first paragraph of
"What Is It?" Do you think that this model adequately answers the
question asked? Why or why not? What alternative solutions could
you provide?

It's important to understand that this StarLogo project isn't
exactly the standard method for solving problems of this sort.
(A more 'classical' approach would be to use techniques from
geometry or calculus.) However, there are many advantages offered
by the StarLogo method. Consider the following other variables
that might affect the solution to the 'rugby conversion problem'-
wind speed, grass height, or the size/weight/skill of the player
to kick. (Such a problem that considers 'real-world' parameters
such as these may quickly become intractable under classical
mathematics.) Try and think of how you'd solve the 'rugby'
problem in its idealized version without using StarLogo. Then try
and solve it, taking into account one or more of these extra
features.

In general, what advantages does the StarLogo solution have
over the other methods? What disadvantages does it have?

You aren't limited to using the DRAW-LEVEL-CURVES button to view
these curves. You can type a line directly to the Command Center-
for example, type:
level-curves 1 90 3
The first number that follows 'level-curves' is analogous to the
value of the ANGLE1 slider. The second number does the same thing
as ANGLE2. The third number is the 'step increment', which
determines the width of the colored bands.

EXTENDING THE MODEL
-------------------
Implement some of the features descibed above under "Things To
Try"- e.g. wind speed, or the size of the player to kick the
conversion from a particular position.

There are a variety of graphs you could have 'rugby' draw in the
Plot Window. Implement graphing procedures for some or all of
the following: the number of successful kicks compared to the
overall kicks, the graph of both types of kicks over time, or the
difference in histograms depending on the locations of the kick-
line (i.e. the value of PERP-LINE) and the goal-posts (GOAL-POS
and GOAL-SIZE).

STARLOGOT FEATURES
-----------------
We draw our histogram straight to the screen in 'rugby', unlike
most other StarLogoT models where the histogram is drawn to the
Plot Window. Compare the code for the histogramming here to that
in another project (e.g the Connected Mathematics model
'Gas-in-a Box').
Which is easier to understand and use? Which is more 'portable'
(i.e. which code would be easier to use in another program
to histogram something else)?

In the 'show-results' procedure, StarLogoT makes use of the
Output Window. You can write text to the output window with
the commands 'type' and 'print' (the former doesn't include
a carriage return, the latter does). This is useful for
displaying information that is more easily conveyed in words
rather than graphics or numbers, as in the plot window, the
display window, or a monitor.

'rugby' also makes extensive use of the ability of turtles
to set patch variables, patches to set observer variables,
and so forth. When a turtle is setting a value of a variable
not belonging to a turtle, it uses the command 'tset' (as
opposed to 'set'). Likewise, a patch uses 'pset'. And although
we don't use it here, the observer sets individual turtle and
patch variables using the 'oset' primitive.

```