[Question]
  [
If you are unfamiliar with hacker typer, see [hackertyper.net](http://hackertyper.net). In short, it is a program that outputs one chunk of a code base per keystroke for comedic effect. BUT, the hackertyper.net version is far too easy to implement. It simply outputs three characters at a time from an *arbitrary* piece of code. For this challenge, a program must output its own source code, and print one *space delimited* chunk of code per keystroke.
## Details
* One cannot hard code a file name for the program; it must determine its name dynamically. If the program compiles to an executable, it may append the standard file extension to the name of the executable (excluding the .exe if using Windows) and assume that the source file is within the executable's directory. For example, if a C executable is named "hacker", it should pull its source code from a file named "hacker.c" in its same directory. If a compiled program has an extension, it should be dropped before determining the name of its source code ("typer.exe" -> "typer.cs").
* Programs must contain at least 5 spaces, with at least one character between each space. This means that the smallest possible size for this challenge is 9 bytes. The spaces do not have to be crucial to the functioning of the program.
* Any formatting (indentation, new lines, etc.) must be maintained in the output. This formatting may either be printed with the code that proceeds it or follows it, what matters is that the formatting be maintained.
* Avoid using comments to satisfy the 5 space requirement unless there is no other way to implement the spaces in your language of choice.
**EDIT**: New lines can be used in place of, or in addition to, spaces as chunk separators.
  
[Answer]
### HTML & JavaScript, 123
```
<head></head><body onload="s=(a=document.all)[i=0].innerHTML" onkeyup="a[2].textContent += s.split(/(?= )/)[i++%6]"></body>
```
This works similarly to hacker typer, but with its own source code. Let me know if I've misunderstood the rules.
And here's a styled version (170 characters):
```
<head></head>
<body style="background:#000;color:lime" onload="s=(a=document.all)[i=0].innerHTML" onkeyup="a[3].textContent+=s.split(/(?=\s)/)[i++%6]">
<pre></pre></body>
```
I've made a [**demo**](http://jsbin.com/pejexu/1/). It's modified because JS Bin adds a lot of extra code, but the general idea is the same.
[Answer]
### bash, 51 58
```
for w in $(<$0);do read -sn 1;printf -- "$w ";done
```
[Answer]
# Perl + Term::ReadKey, 56 bytes
```
use
Term'ReadKey;ReadMode
4;open
0;ReadKey,print
for
<0>
```
Thanks to [ThisSuitIsBlackNot](https://codegolf.stackexchange.com/a/37373) for the original inspiration, and to [primo](https://codegolf.stackexchange.com/questions/37333/create-a-hacker-typer-program-that-renders-its-own-source-code/37381#comment85029_37381) for suggesting `open 0` and `<0>`.
Note that the newline after `for` is actually unnecessary, except that I need to include one extra newline *somewhere* to bring the whitespace count up to the specified minimum of five. 
Also note that, like ThisSuitIsBlackNot's submission, this program requires the [Term::ReadKey](http://search.cpan.org/perldoc?Term%3A%3AReadKey) module from CPAN. On Debian / Ubuntu Linux, this module, if not already present, can be easily installed with the command `sudo apt-get install libterm-readkey-perl`.
Also, to save a few characters, this program does not restore the input mode to normal on exit, so you may find yourself unable to see what you're typing afterwards. Executing the shell command `stty sane` or `reset` should fix that. This issue could be fixed, at the cost of 10 extra bytes, with:
```
use
Term'ReadKey;ReadMode
4;open
0;ReadKey,print
for<0>;ReadMode
0
```
---
## Bonus: Pure quine, 81 bytes
```
$_=q{use
Term'ReadKey;ReadMode
4;ReadKey,say
for
split$/,
"\$_=q{$_};eval"};eval
```
Again, the newline after the comma is only needed to meet the five whitespace minimum.
Unlike the 56-byte program above, this version doesn't actually need to read its own source code, since it's based on a quine — specifically, on this quine:
```
$_=q{say"\$_=q{$_};eval"};eval
```
The nice thing about this quine is that it can easily carry an arbitrary "payload" within the `q{ }` block, without having to repeat it. While it can't quite beat `<0>` in shortness, it does get pretty close.
Note: This program uses the Perl 5.10+ `say` feature, and thus needs to be invoked with the `-M5.010` (or `-E`) command line switch. Per established consensus on meta, such switches used to enable modern language features [do not count as extra characters](http://meta.codegolf.stackexchange.com/questions/273/on-interactive-answers-and-other-special-conditions). The shortest solution I can find without `say` is 83 bytes:
```
$_=q{use
Term'ReadKey;ReadMode
4;ReadKey,print
for
split/^/,
"\$_=q{$_};eval"};eval
```
Both of these can also be made more terminal-friendly by (joining the last two lines and) inserting:
```
;ReadMode
0
```
before the last `}`.
[Answer]
# Python 3 - 124 bytes - 7 spaces
---
Code:
```
from curses import*
s=initscr();noecho()
for x in open(__file__).read().split(" "):s.getch();s.addstr(x+" ")
echo();endwin()
```
Ungolfed:
```
from curses import*
# init curses
screen=initscr()
noecho()
# split code into spaces
code = open(__file__).read().split(" ")
for x in code:
    # wait for keypress
    screen.getch()
    # print a bit
    screen.addstr(x+" ")
# deactivate curses
echo()
endwin()
```
Styled version:
```
from curses import*
s=initscr();noecho();start_color();init_pair(2,COLOR_GREEN,COLOR_BLACK)
for x in open(__file__).read().split(" "):s.getch();s.addstr(x+" ",color_pair(2))
echo();endwin()
```
[Answer]
# Ruby, 85, 71
```
require"io/console";f=File.open __FILE__;loop{STDIN.raw &:getc;print f.read(3)||exit}
```
Too bad that `IO#raw` is not part of the standard library.
### Improvement
```
require"io/console";24.times{|q|STDIN.raw &:getc;$><<IO.read($0,3,q*3)}
```
This one eliminates the call to Kernel#exit and uses global variables to shorten the code.
[Answer]
# Befunge - 21
```
~ $ g , 1 +:54*`#@_:0
```
I'm fairly pleased with this, as I just found out about Befunge. If you don't mind "typing" into a popup window, you can run it [here](http://www.bedroomlan.org/tools/befunge-93-playground) or [here](https://www.ashleymills.com/befunge_applet_full) until I find a better online interpreter.
[Answer]
## Powershell, 89
```
(gc $MyInvocation.MyCommand.Path).split(" ")|%{$l+="$_ ";write-host "$l";read-host ;cls}
```
[Answer]
## Python 3 - 299
```
a="""from curses import*
s=initscr()
raw()
noecho()
for x in e:
 s.getch()
 s.addstr(x+' ')
nocbreak()
echo()
endwin()
""";b="""e=(a+'a=#%s#;b=#%s#;%s'%(a,b,b.replace('#','""''"',4))+'exec(a)').split(' ')
""";e=('a="""%s""";b="""%s""";%s'%(a,b,b.replace('#','""''"',4))+'exec(a)').split(' ')
exec(a)
```
Its a quine. Shortened from 507 by using `exec` and moving some statements around.
[Answer]
# C, 211 186 bytes
My solution in C using the curses library. It may be longer than the other C solution, but it is a quine. Although not required by the question, it's still pretty nice. It also works quite nicely:
```
#define R(x)#x
#define T(x)R(x)
#define S(p)char*s="#define R(x)#x\n#define T(x)R(x)\n#define S(p)"p"\nS(T(S(p)))";main(){initscr();noecho();while(*s)if(~getch())addch(*s++);}
S(T(S(p)))
```
A more readable version with some comments and stuff:
```
#define R(x)#x /* macros to convert the source code in S into a C-string */
#define T(x)R(x)
#define S(p) char*s="#define R(x)#x\n" \
                    "#define T(x)R(x)\n" \
                    "#define S(p) " p "\n" \
                    "S(T(S(p)))";\
    main(){\
        initscr();\
        noecho(); /* don't echo input */ \
        while(*s)\
            if(~getch()) /*true if character has been typed */ \
                addch(*s++);\
}
S(T(S(p)))
```
compile with:
```
gcc -o h h.c -lncurses
```
[Answer]
# C - 136 135 132 bytes (Windows only)
```
*fopen();**v;b[ 1<<20];main(p,q){v=q; strcpy(b,*v);strcat(b,".c") ;for(*v=fopen(b,"r");~fscanf(*v,"%s",b);printf("%s ",b))getch();} 
```
Note: there is a space at the end of the program, which probably won't show up.
I can't guarantee this program will work on a single computer other than my own as it is awesomely hacky. Things would have been a lot simpler back when everyone only had 32-bit machines. Then I would not need to worry about `sizeof(int*)` being 8 (which it definitely is; I printed it out to make sure) while `sizeof(int)` is 4.
Happily, the name of the executable is stored in the first string in argv.  ~~However, putting a pointer as an argument to a function means that I have to explicitly specify the type of ALL the arguments to the function--meaning I would have to type `int` twice--a huge waste of characters.~~  Fortunately I found a workaround. I had the second argument to main, `q`, be just another int. Then assigning `q` to a variable of type `int**` somehow managed to grab all the necessary bytes from the stack.
I was unsuccessful in finding any such tricks to interpret the return type of `fopen` as a pointer without declaring the function.
Edit: Noticed I should use `~fscanf(*v,"%s",b)` instead of `fscanf(*v,"%s",b)>0` since the return is -1 when EOF is reached.
[Answer]
# Perl - 87 bytes
```
#!/usr/bin/perl -040
use Term::ReadKey;open F,$0;ReadMode 3;print''.<F>while ReadKey 0
```
I didn't see anything in the rules about what to do once the file has been read to the end, so it simply sits waiting for input after printing the last chunk.
[Answer]
node.js with LiveScript:
```
#!/usr/local/bin/lsc
console.log <| require \fs .readFileSync __filename, encoding: \utf8
```
asynchronous version:
```
#!/usr/local/bin/lsc
require \fs .readFile __filename, encoding: \utf8, -> console.log &1
```
[Answer]
# Cobra - 147
```
class P
    def main
        while 1,for a in File.readLines(CobraCore.exePath[:-4]+'.cobra'),print if('[Console.readKey]'and (Console.cursorLeft=0)<1,a,'')*
```
`CobraCore.exePath` is so useful!
[Answer]
# Javascript ES6, 154
**Firefox 154**:
```
(a= (i=1,b="(a= "+a+")()",s="") => {window.onkeydown=()=>{clear();i=b.indexOf(" ",i+1),d=b.slice(0,i<0?b.length:i);console.log(s+d);if(i<0){i=0,s+=d}}})()
```
**Chrome 175**:
```
( a= function (i,s){b="( a= "+a+")()";c=console,window.onkeydown=function(){c.clear();s=s||"",i=b.indexOf(" ",i+1),d=b.slice(0,i<0?b.length:i);c.log(s+d);if(i<0){i=0,s+=d}}})()
```
**Both 274**:
```
( a= function (i,s){b="( a= "+a+")()";c=console,window.onkeydown=function(){(clear)?clear():c.clear?c.clear():0;s=s||"",i=b.indexOf(" ",i+1),d=b.slice(0,i<0?b.length:i);c.log(s+d);if(i<0){i=0,s+=d}}})()
```
**Ungolfed** (chrome):
```
( a= function (i,s){        // starting index | undefined, output string
    b="( a= "+a+")()";      // get a string representation of the function
    c=console,
    window.onkeydown=function(){    // on each key down event
        c.clear();                  // clear the output 
        s=s||"";
        i=b.indexOf(" ",i+1);       // get the index of next space
        d=b.slice(0,i<0?b.length:i);// get the string part wanted
        c.log(s+d);                 // print the string
        if(i<0){
            i=0,                    // reset counters
            s+=d                    // adding the string to the main output
        }
    }
})()
```
Has two versions, because Chrome does not handle arrow function and the console is not cleared with the same method
The Firefox one work with firebug, it seem that the default developer console can't be cleared from a script.
[Answer]
## C, 248 characters
**True quine**
Only works in unix, in windows it would be implemented using \_getch.
```
main(){char *p="main(){char *p=\"%s\",s[400];sprintf(s,p,p);system(\"stty raw\");for(p=s;*p!=0;putchar(*p++))getchar();system(\"stty cooked\");}",s[400];sprintf(s,p,p);system("stty raw");for(p=s;*p!=0;putchar(*p++))getchar();system("stty cooked");}
```
[Answer]
# Groovy - 379
```
import java.nio.file.*
Path p = Paths.get(System.getProperty("user.dir"))
DirectoryStream<Path> f = Files.newDirectoryStream(p,"*.groovy")
try{for(e in f){read(e.toAbsolutePath().toString())}}
catch(Exception e){ }
finally{f.close()}
void read(String x){
    def s = new File(x).text
    for(e in s.replace("%n"," %n").split(" ")) 
        print e + " " 
    Thread.sleep(200)
}   
```
Since there is no `getch()` or equivalent in Java and Java-esque languages like Groovy... basically my code doesn't handle keypresses. That's all :D
[Answer]
# HTML and Javascript, 232 bytes
```
<body><script>var n=0;var f=function (){document.onkeypress=function(){document.body.innerHTML+=("&lt;body>&lt;script>var n=0;var f="+f.toString()+"f()&lt;/script>&lt;/body>").split(" ")[n]+" ";n++;}};f()</script></body>
```
The traditional Javascript quine, but modified.
JSFiddle [here](http://jsfiddle.net/fog3vc1z/).
[Answer]
# SmileBASIC, ~~79~~ 75 bytes
```
LOAD"PRG1:"+PRGNAME$()
PRGEDIT 1
@L
IF BUTTON(2)THEN?PRGGET$();
WAIT
GOTO@L
```
~~It's very easy to get a specific LINE of a program in SmileBASIC, so I just put the spaces before each line break.~~ I thought I was so clever, putting the spaces before each line break, but apparently we're allowed to use line breaks instead of spaces...
Explanation:
```
LOAD "PRG1:"+PRGNAME$() 'load the code into slot 1 so we can easily read 1 line at a time
PRGEDIT 1 'Edit slot 1
@LOOP
IF BUTTON(2) THEN 'When a button is pressed...
                   PRINT PRGGET$(); 'get a line of code and print it
WAIT 'delay so we don't detect the same press multiple times in a single frame.
GOTO @LOOP 
```
]