キータイプ矯正ソフト ドカベンコマンド

## ガイヨウ
`ls` をよく `dokaben` と打ち間違えてしまう、、、
これは誰もが抱えるそんな悩みを解消するためのキータイプ矯正ソフトです。
以下は実際に打ち間違えてしまった場合の様子です。

＼ﾃｰﾃｰﾃｰﾃﾃﾃﾃｯﾃﾃｰ／
![dokaben.gif](https://qiita-image-store.s3.amazonaws.com/0/54587/76233eb3-144c-9b15-ce04-760c104889ba.gif)



## ソースコード
Rubyで書きました。
curses でつくろうかとも思ったのですが、今回はお手軽にエスケープシーケンスで済ませました。
文字の方は地味に頑張って手作りしました。

特にインストールなどは必要なく、以下に示すコードを実行すれば冒頭のGIFのようになります。
あとはコマンドとして使えるように各位よしなにしてください。

```ruby
DOKABEN = [
  0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
  0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000078007e00e00700000001ff07ffe3f801c78000079e03ffe78fe3ffc0001f001fdfc001f00000000000000000000000000,
  0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f8007c00e00f00000001f1c7ffe0f3c783000001f007ffe1f803e3800003ff07ffe7fe0007c00007fe03fbe7dfc3ffe0000f9e0ff7e78ff1ffc0001f041fffc303f0ff80003f001f9f8000f80000000000080c0000000000000000000000000000000,
  0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000001f1407c00f007c2000003e3c7ffe0f143c1800003e587ffe1f941e1c00007f00fffe1fc01f1e00007ff0fffe7fe0003e00007fe0fffe7ff811fe0000ffe03f3e7cff1ffe0001f1c0ff7e78ff1ffe0001f0c3fffc307f8ffc0003e001fffc201f8ff00007e001f9f8000f800000000000e1e000018000000000000000000000000000000000000000000000,
  0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000fc000003c0000007c680fc00f003e0c00007c58fffe0f1a1f0e0000fcf0fffe0f9e1f0f0000fc00fffe1fd20f8f0000ffe0fffe3fe00f8f0000ffe1fffe7ff0001f0001ffe1fffe7ffc1fff8001ffc03f7e7eff9fff0001f7c0ff7e7cff8fff0003e1c3fffe787f8fff0003e083fffc303f8ffc0003e003fffc201f87f00007e001f9f8000f8000000fe001e1f0000380000000000080c000000000000000000000000000000000000000000000000000,
  0x0000000000000000000000000000000000000000000000000000000f000003f0001f8007000f800003f1a01f8007800f818003e1e1fffe0f8d8fc1c003e363fffe0fcd07c1c003f043fffe0fcf07c1e003f803fffe1fe003e3e003ffc3fffe3ff003e3e003ff83fffe7ff80007e003ff83fffe7ffc0fffe007ff807f7e7eff8fffc007ff80fe7e7c7fc7ffc007c787fefe7c7fc7ff8007c387fffc383fc7ff0007c107fffc301fc7fe000fc003fffc201f87f8000fc003f9f800078000000fc001f1f00003800000000001c1e00001800000000000000000000000000000000000000000000000000000000000000000,
  0x00000000000000000000000000000000000000000000003f8000000fc00007e1403f80078007c08007e343bf9c078687c0e007c3c3fffe0fc787e0e007e6c3fffe0fcd83e0e007f003fffe1fed03e1e007f803fffe1fe003f1e007ff83fffe7ff00003e007ff83fffe7ffc0007e007ff82ff7e7ffe07ffe007ff807f7e7effc7ffe007df01fe7e7c7fc7ffc007c707fefe3c7fc7ffc00fc307fffc383fc7ff800fc107fffc301fc7fe000fc003fffc200fc7f0000fc003f9f80007c000001fc001e1f00003c00000000001c1e00000c00000000000000000000000000000000000000000000000000000000000000000,
  0x00000000000000000000000000000000000000000000003f80000007e0001fc2c03f8007c007e0601fc6c7bffc07c6c3e0700fc787fffe07c6c3f0780fc587fffe0fe783f0f80fe007fffe1fe581f0f00fff07fffe3ff001f0f00fff03fffe7ff80001f00fff03fffe7ffc0007f00fff00ff7e7fff07fff00fff00fe7e7e7fe7fff00f9f01fe7e7c7fc7ffe00f8f0ffefe3c3fc7ffc00f8307fffc383fc7ff800f8107fffc301fc3fe000fc003fffc200fc3f8001fc003f1f80007c000001fc001e1f00003c00000000001c1e00000c00000000000000000000000000000000000000000000000000000000000000000,
  0x00000000000000000000000000000000000000000000003f80000007e0001fc2c03f8007c007e0601fc6c7bffc07c6c3e0700fc787fffe07c6c3f0780fc587fffe0fe783f0f80fe007fffe1fe581f0f00fff07fffe3ff001f0f00fff03fffe7ff80001f00fff03fffe7ffc0007f00fff00ff7e7fff07fff00fff00fe7e7e7fe7fff00f9f01fe7e7c7fc7ffe00f8f0ffefe3c3fc7ffc00f8307fffc383fc7ff800f8107fffc301fc3fe000fc003fffc200fc3f8001fc003f1f80007c000001fc001e1f00003c00000000001c1e00000c00000000000000000000000000000000000000000000000000000000000000000,
  0x00000000000000000000000000000000000000000000003f80000007e0001fc2c03f8007c007e0601fc6c7bffc07c6c3e0700fc787fffe07c6c3f0780fc587fffe0fe783f0f80fe007fffe1fe581f0f00fff07fffe3ff001f0f00fff03fffe7ff80001f00fff03fffe7ffc0007f00fff00ff7e7fff07fff00fff00fe7e7e7fe7fff00f9f01fe7e7c7fc7ffe00f8f0ffefe3c3fc7ffc00f8307fffc383fc7ff800f8107fffc301fc3fe000fc003fffc200fc3f8001fc003f1f80007c000001fc001e1f00003c00000000001c1e00000c00000000000000000000000000000000000000000000000000000000000000000,
  0x00000000000000000000000000000000000000000000003f80000007e0001fc2c03f8007c007e0601fc6c7bffc07c6c3e0700fc787fffe07c6c3f0780fc587fffe0fe783f0f80fe007fffe1fe581f0f00fff07fffe3ff001f0f00fff03fffe7ff80001f00fff03fffe7ffc0007f00fff00ff7e7fff07fff00fff00fe7e7e7fe7fff00f9f01fe7e7c7fc7ffe00f8f0ffefe3c3fc7ffc00f8307fffc383fc7ff800f8107fffc301fc3fe000fc003fffc200fc3f8001fc003f1f80007c000001fc001e1f00003c00000000001c1e00000c00000000000000000000000000000000000000000000000000000000000000000,
  0x00000000000000000000000000000000000000000000003f80000007e0001fc2c03f8007c007e0601fc6c7bffc07c6c3e0700fc787fffe07c6c3f0780fc587fffe0fe783f0f80fe007fffe1fe581f0f00fff07fffe3ff001f0f00fff03fffe7ff80001f00fff03fffe7ffc0007f00fff00ff7e7fff07fff00fff00fe7e7e7fe7fff00f9f01fe7e7c7fc7ffe00f8f0ffefe3c3fc7ffc00f8307fffc383fc7ff800f8107fffc301fc3fe000fc003fffc200fc3f8001fc003f1f80007c000001fc001e1f00003c00000000001c1e00000c00000000000000000000000000000000000000000000000000000000000000000,
  0x00000000000000000000000000000000000000000000003f8000000fc00007e1403f80078007c08007e343bf9c078687c0e007c3c3fffe0fc787e0e007e6c3fffe0fcd83e0e007f003fffe1fed03e1e007f803fffe1fe003f1e007ff83fffe7ff00003e007ff83fffe7ffc0007e007ff82ff7e7ffe07ffe007ff807f7e7effc7ffe007df01fe7e7c7fc7ffc007c707fefe3c7fc7ffc00fc307fffc383fc7ff800fc107fffc301fc7fe000fc003fffc200fc7f0000fc003f9f80007c000001fc001e1f00003c00000000001c1e00000c00000000000000000000000000000000000000000000000000000000000000000,
  0x0000000000000000000000000000000000000000000000000000000f000003f0001f8007000f800003f1a01f8007800f818003e1e1fffe0f8d8fc1c003e363fffe0fcd07c1c003f043fffe0fcf07c1e003f803fffe1fe003e3e003ffc3fffe3ff003e3e003ff83fffe7ff80007e003ff83fffe7ffc0fffe007ff807f7e7eff8fffc007ff80fe7e7c7fc7ffc007c787fefe7c7fc7ff8007c387fffc383fc7ff0007c107fffc301fc7fe000fc003fffc201f87f8000fc003f9f800078000000fc001f1f00003800000000001c1e00001800000000000000000000000000000000000000000000000000000000000000000,
  0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000fc000003c0000007c680fc00f003e0c00007c58fffe0f1a1f0e0000fcf0fffe0f9e1f0f0000fc00fffe1fd20f8f0000ffe0fffe3fe00f8f0000ffe1fffe7ff0001f0001ffe1fffe7ffc1fff8001ffc03f7e7eff9fff0001f7c0ff7e7cff8fff0003e1c3fffe787f8fff0003e083fffc303f8ffc0003e003fffc201f87f00007e001f9f8000f8000000fe001e1f0000380000000000080c000000000000000000000000000000000000000000000000000,
  0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000001f1407c00f007c2000003e3c7ffe0f143c1800003e587ffe1f941e1c00007f00fffe1fc01f1e00007ff0fffe7fe0003e00007fe0fffe7ff811fe0000ffe03f3e7cff1ffe0001f1c0ff7e78ff1ffe0001f0c3fffc307f8ffc0003e001fffc201f8ff00007e001f9f8000f800000000000e1e000018000000000000000000000000000000000000000000000,
  0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f8007c00e00f00000001f1c7ffe0f3c783000001f007ffe1f803e3800003ff07ffe7fe0007c00007fe03fbe7dfc3ffe0000f9e0ff7e78ff1ffc0001f041fffc303f0ff80003f001f9f8000f80000000000080c0000000000000000000000000000000,
  0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000078007e00e00700000001ff07ffe3f801c78000079e03ffe78fe3ffc0001f001fdfc001f00000000000000000000000000,
]
.map { |dokaben| dokaben.to_s(2).rjust(24*80, "0").scan(/.{1,80}/) }
.map { |dokaben| dokaben.map { |line| line.each_char.map { |pixel| pixel == "1" ? "\e[48;5;#{124}m  \e[0m" : "  " }.join }.join("\n") }

print "\e[?25l"

begin
  DOKABEN.each do |dokaben|
    print dokaben
    print "\e[#{24}A"
    STDOUT.flush
    sleep 0.2
  end
rescue Interrupt
  print "\e[?25h"
  exit 0
end while true
```

## キノウ
### キノウ①　ループサイセイカノウ
てかループしかできない。
### キノウ②　ソクドヘンコウカノウ
`sleep 0.2` してるところをいじってください。
### キノウ③　コマオトシフカノウ
### キノウ④　カイテンジクイドウフカノウ

## Q and A
Q. なんか表示が崩れる
A. ドカベンの文字を表示するために割と横幅を要求します。表示が崩れてしまう場合はお手数ですが、端末を最大化するか文字を小さくするかしてください。

Q. ループが止まらない
A. `Ctrl` + `C` で強制終了させるまでループは止まりません。

## オシマイ
参考
[sm29720917](http://www.nicovideo.jp/watch/sm29720917)
[sm30220788](http://www.nicovideo.jp/watch/sm30220788)
[CSSで再現するドカベンOPの文字エフェクト](http://qiita.com/trkbt10/items/e451a9d90b90e7bb551f)