A golfed golfing game You have to make a golf game with the following specification :-

The field is 10 X 10 characters without spaces.

Free ground is represented by .

A hole generated at random(not at 0,0) is shown by O (its alphabet and not zero).

The ball starts at 0,0 represented by X.

You can hit the ball with input d 4 (meaning direction to the bottom with magnitude of 4 characters after the ball more like vectors in physics).
Example:
X.........
..........
..........
..........
..........
..........
..........
..........
..........
.........O
score : 0
b 4

But, since you are not so good at golfing therefore the force you think is applied is often only close to the actual force that is applied !(if x the offset in force then -2 &lt; X &lt; +2)

you should have to tell the real force applied and display the ball moved to that real force like this :-
lets say the ball actually moved by 3.

..........
..........
..........
X.........
..........
..........
..........
..........
..........
.........O
score : 1
applied force : 4
real force    : 3

The four directions are U (up), D (down), l (left), r (right) and magnitude of force should be between 0 and 10 (excluding both 0 and 10).

The ball should not bounce off the edges, if the force reaches that much then the the ball stops at the last point at the boundary.
r 9

..........
..........
..........
.........X
..........
..........
..........
..........
..........
.........O
score : 2
applied force : 9
real force    : 11


In the end when the game is finished you have to display Par in &lt;n&gt; shots! (where n is score)


Coding:

You have to design a working program showing the exact output.
post the code in golfed and ungolfed versions.
also post a successful test run (images if possible).
No use of functions or languages excessively specialized to this task (I don't know if they really exist!)

Winner:
Winner will be chosen 1 week from now.
Winner is the submission with least characters.
And, most important thing
Best of luck :)
Scala, 605

Golfed:
import scala.util.Random;object G extends App{var b,h=(0,0);while(b==h)h =(Random.nextInt(10),Random.nextInt(10));var s=0;def f{for(y&lt;- 0 to 9){for(x&lt;- 0 to 9)print(if(b==(x,y))&quot;X&quot;else if(h==(x,y))&quot;O&quot;else &quot;.&quot;);println};println(&quot;score : &quot;+s)};f;while(b!=h){val i=readLine.split(&quot; &quot;);val x=i(1).toInt.ensuring(a=&gt;a&gt;0&amp;&amp;a&lt;10)-1+Random.nextInt(3);b=i(0).toLowerCase match{case &quot;d&quot;=&gt;(b._1,b._2+x) case &quot;u&quot;=&gt;(b._1,b._2-x) case &quot;r&quot;=&gt;(b._1+x,b._2) case &quot;l&quot;=&gt;(b._1-x,b._2)};b=(b._1.min(9).max(0),b._2.min(9).max(0));s+=1;f;println(&quot;applied force : &quot;+i(1));println(&quot;real force : &quot;+x)};println(&quot;Par in &quot;+s+&quot; shots!&quot;)}

Just a straight-forwardly implemented ice-breaker. Input is read line-by-line from stdin and power lower then 1 or higher then 9 will result in an AssertionError to comply with the specs.
I am pretty sure there are shorter programs, but let's see how far we get ;-)
Ungolfed:
import scala.util.Random

object Golf extends App {
  var b, h = (0, 0)
  while (b == h) h = (Random.nextInt(10), Random.nextInt(10))
  var s = 0

  def field {
    for (y &lt;- 0 to 9) {
      for (x &lt;- 0 to 9)
        print(if (b ==(x, y)) &quot;X&quot; else if (h ==(x, y)) &quot;O&quot; else &quot;.&quot;)
      println
    }
    println(&quot;score : &quot; + s)
  }
  field
  while (b != h) {
    val i = readLine.split(&quot; &quot;)
    val x = i(1).toInt.ensuring(a =&gt; a &gt; 0 &amp;&amp; a &lt; 10) - 1 + Random.nextInt(3)
    b = i(0).toLowerCase match {
      case &quot;d&quot; =&gt; (b._1, b._2 + x)
      case &quot;u&quot; =&gt; (b._1, b._2 - x)
      case &quot;r&quot; =&gt; (b._1 + x, b._2)
      case &quot;l&quot; =&gt; (b._1 - x, b._2)
    }
    b = (b._1.min(9).max(0), b._2.min(9).max(0))
    s += 1
    field
    println(&quot;applied force : &quot; + i(1))
    println(&quot;real force : &quot; + x)
  }
  println(&quot;Par in &quot; + s + &quot; shots!&quot;)
}

Random example run:

X......O..
..........
..........
..........
..........
..........
..........
..........
..........
..........
score : 0

r 8
.......OX.
..........
..........
..........
..........
..........
..........
..........
..........
..........
score : 1
applied force : 8
real force : 8

l 1
.......OX.
..........
..........
..........
..........
..........
..........
..........
..........
..........
score : 2
applied force : 1
real force : 0

l 1
.......X..
..........
..........
..........
..........
..........
..........
..........
..........
..........
score : 3
applied force : 1
real force : 1
Par in 3 shots!