Turtle Graphics Program Most of you have probably heard of the famous Turtle Graphics program, initially made popular by Logo.  This challenge is to implement a Turtle Graphics program in your language of choice.

Rules:


Rule one is that when the pen is in the down state, it must draw in both the square the turtle leaves and the square the turtle enters.  This is what would happen in real life, so that is what your program should do.
Rule two is the turtle must include these 10 commands, which can be represented in the input as you like:



  RESET - resets board to blank - turtle position is default.
  
  UP and DOWN - these two commands set the pen/eraser state.
  
  RIGHT and LEFT - these two commands turn the turtle in the specified direction.
  
  FORWARD - advances turtle to next square.
  
  DRAW and ERASE - these commands set the turtle to drawing and erasing, respectively.
  
  DISPLAY - displays board.
  
  POSITION - prints turtle's x/y coordinate on the board.
  
  STOP, which stops drawing, displays the board, and terminates the program after the user enters any input.



The floor must be 20x20.  You can use vectors, arrays, or anything you like to represent it.
You must stop the turtle and display an error message if the turtle hits the wall.
Default turtle position is 0,0 facing right.


Scoring:

This program will use standard atomic-code-golf scoring rules with a few modifications to try to allow industry programming languages, such as Java and C++, to compete.


Imports, includes, usings and other similar statements do not score anything.
Loop header statements each only score one point.  All other statements add the full number of characters in the statement to the score.


Example:

These statements do not score:

#include &lt;iostream&gt;
import java.util.Scanner;

def inputCommand():
string inputCommand(){}


These statements score only one point:

for(int i = 0; i &lt; 9; i++){}
for i in range(0,10):
while(true){}
while x in y:


These statements score the full number of their characters:

string n;
i = 9;

switch(d) {
  case i:
    break;
  default:
    break;
}

return x;

cout&lt;&lt;'example';
cin&gt;&gt;s;
System.out.println()
print('example')


If you have any questions or comments, please let me know in the comments.
JavaScript, one point

for (s='                    ',
    reset=function(){a=s.split(/./).map(function(){return s.split(/(?=.)/)}); x=0; y=0; dx=1; dy=0; pen='#'; down=1;},
    display=function(){console.log(a.map(function(x){return x.join('')}).join('\n'))},
    position=function(){console.log(x, y)},
    draw=function(){a[y][x]=down?pen:a[y][x]},
    forward=function(){draw(); x+=dx; y+=dy; (y&lt;0||y&gt;19||x&lt;0||x&gt;19) &amp;&amp; (console.log('Hit wall')||(dx?(x-=dx):(y-=dy))); draw();},
    turn=function(d){nx=-1*(!dx)*d*dy; dy=(!dy)*d*dx; dx=nx;},
    reset();
    ((p=prompt()) != 'STOP') || display();
    (p == "RESET") &amp;&amp; reset(),
    (p == "DISPLAY") &amp;&amp; display(),
    (p == "POSITION") &amp;&amp; position(),
    (p == "DRAW") &amp;&amp; (pen='#'),
    (p == "ERASE") &amp;&amp; (pen=' '),
    (p == "UP") &amp;&amp; (down=0),
    (p == "DOWN") &amp;&amp; (down=1),
    (p == "RIGHT") &amp;&amp; turn(1),
    (p == "LEFT") &amp;&amp; turn(-1),
    (p == "FORWARD") &amp;&amp; forward()
);


Sorry, I couldn't resist.