6
\$\begingroup\$

About Hangul

As I'm Korean, I'm really proud of Korean character, Hangul(한글).

Hangul is artificial character made by King Sejong the great, 4th king of Joseon dynasty, at 1443.

Because today(October 9th) is Hangul day in Korea, I'll give you a challenge : Make Hangul ascii/box-styiled art.

List of characters

So, To make ascii art, you have to know every characters represent each syllables, right?

No. There are 11172 syllables in Korean character, so it's almost impossible to hardcode it. But, there are only 24 basic characters :

ㄱㄴㄷㄹㅁㅂㅅㅇㅈㅊㅋㅌㅍㅎㅏㅑㅓㅕㅗㅛㅜㅠㅡㅣ

And Korean character compose these to make that much syllables.

How to compose

24 basic characters can be separated into two part : consonant and vowel.

Leading 14 characters, ㄱㄴㄷㄹㅁㅂㅅㅇㅈㅊㅋㅌㅍㅎ, are consonants, and following 10 characters, ㅏㅑㅓㅕㅗㅛㅜㅠㅡㅣ are vowels.

There are roughly 3 part in Korean character : Initial consonant, Vowel, and Final consonant.

Initial consonant

Initial consonant (초성 in Korean) is simplest part. It is just consonant, only with ㄲㄸㅃㅆㅉ(double consonant). It placed in top-left position.

Vowel

Vowel (중성 or 모음 in Korean) is hardest part. Here is list of every vowel : ㅏㅐㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜㅝㅞㅟㅠㅡㅢㅣ

ㅏㅐㅏㅒㅓㅔㅕㅖㅣ is on the right side of initial consonant, ㅗㅛㅜㅠㅡ is at the bottom, ㅘㅙㅚㅝㅞㅟㅢ is both. For example, 가, 고, 과.

Final consonant

Final consonant (종성 in Korean) is at the bottom-most side. Here is list of final consonant : ㄱㄲㄳㄴㄵㄶㄷㄹㄺㄻㄼㄽㄾㄿㅀㅁㅂㅄㅅㅆㅇㅈㅊㅋㅌㅍㅎ, and blank.

Here is example of some characters using final consonant : 각, 갌, 갏

How to decompose Unicode

See this webpage for help.

Quest

Input is like this format : (number) Korean char (number) Korean char ... Where (number) is optional. If number is given, change ascii(or unicode) art style to given number. 1 and 2 are ascii-art, and 3 is unicode box-art.

Seperate characters with 2 spaces. Note that not every character has same width.

If vowel is not ㅗㅛㅜㅠㅡ, following final consonant must indented with a space.

Default style is 1, so if first character is not number, style 1 is used.

This is example input : 1한2글3날 or 한3글날.

Here is list of Korean ascii art(style 1 and 2).

Here is list of Korean unicode box-art(style 3).

List of Ascii art

Style 1

ㄱ
___
   |
   |

ㄴ
|
|
|__

ㄷ
 ___
|
|___

ㄹ
___
 __|
|___

ㅁ
 __
|  |
|__|

ㅂ
|  |
|__|
|__|

ㅅ
 /\
|  |
|  |

ㅇ
 __
/  \
\__/

ㅈ
____
 /\
/  \

ㅊ
 __ 
____
/  \

ㅋ
___
___|
   |

ㅌ
 ___
|___
|___

ㅍ
____
 ||
_;;_

ㅎ
 __
____
 ()

ㄲ
_ _
 | |
 | |

ㄸ
 _ _
| |
|_|_

ㅃ
||||
[][]
""""

ㅆ
/|/|
||||
||||

ㅉ
____
/|/|
||||

ㅏ
    |
    |_
    |
    |

ㅐ
    | |
    |_|
    | |
    | |

ㅑ
    |
    |_
    |_
    |

ㅒ
    | |
    |_|
    |_|
    | |

ㅓ
     |
    _|
     |
     |

ㅔ
     ||
    _||
     ||
     ||

ㅕ
     |
    _|
    _|
     |

ㅖ
     ||
    _||
    _||
     ||

ㅗ



 |
_|__

ㅘ
    |
    |
    |_
 |  |
_|__|

ㅙ
    | |
    | |
    |_|
 |  | |
_|__| |

ㅚ
    |
    |
    |
 |  |
_|__|

ㅛ



 ||
_][_

ㅜ



____
 |

ㅝ
    |
    |
    |
____|
 |--|

ㅞ
    ||
    ||
    ||
____||
 |--||

ㅟ
    |
    |
    |
____|
 |  |

ㅠ



____
 ||

ㅡ



____

ㅢ
    |
    |
    |
    |
____|

ㅣ
    |
    |
    |
    |

ㄳ
_ /|
 |||
 |||

ㄵ
| __
| /|
|_||

ㄶ
| __
| __
|_()

ㄺ
_ _ 
 ] |
[_ |

ㄻ
_ ++
 ]||
[_""

ㄼ
_ ||
 ][]
[_""

ㄽ
_ /|
 ]||
[_||

ㄾ
_  _
 ]|_
[_|_

ㄿ
_ __
 ]][
[_""

ㅀ
_ __
 ]__
[_()

Style 2

ㄱ
---.
   :
   :

ㄴ
:
:
'---

ㄷ
.---
:
'---


ㄹ
---.
.--'
'---

ㅁ
.--.
:  :
'--'

ㅂ
:  :
:--:
'--'

ㅅ
 ,.
:  :
:  :

ㅇ
 ..
(  )
 ''

ㅈ
-.,-
 ;:
'  `

ㅊ
 -- 
-,.-
;  :

ㅋ
---.
---:
   :

ㅌ
.---
:---
'---

ㅍ
-..-
 ::
-''-

ㅎ
 --
----
 ()

ㄲ
-.-.
 : :
 : :

ㄸ
.-.-
: : 
'-'-

ㅃ
::::
[][]
''''

ㅆ
,:,:
::::
::::

ㅉ
----
,:,:
::::

ㅏ
    :
    :-
    :
    :

ㅐ
    : :
    :-:
    : :
    : :

ㅑ
    :
    :-
    :-
    :

ㅒ
    : :
    :-:
    :-:
    : :

ㅓ
     :
    -:
     :
     :

ㅔ
     ::
    -::
     ::
     ::

ㅕ
     :
    -:
    -:
     :

ㅖ
     ::
    -::
    -::
     ::

ㅗ


 :
-^--

ㅘ
    :
    :
    :-
 :  :
-^--:

ㅙ
    : :
    : :
    :-:
 :  : :
-^--: :

ㅚ
    :
    :
    :
 :  :
-^--:

ㅛ



 ::
-^^-

ㅜ



-v--
 :

ㅝ
    :
    :
    :
-v--:
 :--:

ㅞ
    ::
    ::
    ::
-v--::
 :--::

ㅟ
    :
    :
    :
-v--:
 :  :

ㅠ



-vv-
 ::

ㅡ



----

ㅢ
    :
    :
    :
    :
----:

ㅣ
    :
    :
    :
    :

ㄳ
-.,:
 :::
 :::

ㄵ
: --
: ,:
'-::

ㄶ
: --
: --
'-()

ㄺ
-.-.
.' :
'- :

ㄻ
-...
.'::
'-''

ㄼ
-.::
.'][
'-''

ㄽ
-.,:
.'::
'-::

ㄾ
-..-
.':-
'-'-

ㄿ
-...
.'][
'-''

ㅀ
-.--
.'--
'-()

Style 3

ㄱ
───┐
   │
   │

ㄴ
│
│
└──

ㄷ
┌───
│
└───

ㄹ
───┐
┌──┘
└───

ㅁ
┌──┐
│  │
└──┘

ㅂ
│  │
├──┤
└──┘

ㅅ
 ╱╲
│  │
│  │

ㅇ
╭──╮
│  │
╰──╯

ㅈ
────
 ╱╲
╱  ╲

ㅊ
 ── 
────
╱  ╲

ㅋ
───┐
───┤
   │

ㅌ
┌───
├───
└───

ㅍ
─┬┬─
 ││
─┴┴─

ㅎ
 ──
────
 ()

ㄲ
─┐─┐
 │ │
 │ │

ㄸ
┌─┌─
│ │
└─└─

ㅃ
││││
├┤├┤
└┘└┘

ㅆ
╱│╱│
││││
││││

ㅉ
────
╱│╱│
││││

ㅏ
    │
    ├─
    │
    │

ㅐ
    │ │
    ├─┤
    │ │
    │ │

ㅑ
    │
    ├─
    ├─
    │

ㅒ
    │ │
    ├─┤
    ├─┤
    │ │

ㅓ
     │
    ─┤
     │
     │

ㅔ
     ││
    ─┤│
     ││
     ││

ㅕ
     │
    ─┤
    ─┤
     │

ㅖ
     ││
    ─┤│
    ─┤│
     ││

ㅗ



 ╷
─┴──

ㅘ
    │
    │
    ├─
 ╷  │
─┴──│


ㅙ
    │ │
    │ │
    ├─┤
 ╷  │ │
─┴──│ │

ㅚ
    │
    │
    │
 ╷  │
─┴──│

ㅛ



 ╷╷
─┴┴─

ㅜ



─┬──
 ╵

ㅝ
    │
    │
    │
─┬──│
 ╵──┤

ㅞ
    ││
    ││
    ││
─┬──││
 ╵──┤│

ㅟ
    │
    │
    │
─┬──│
 ╵  │

ㅠ



─┬┬─
 ╵╵

ㅡ



────

ㅢ
    │
    │
    │
    │
────│

ㅣ
    │
    │
    │
    │

ㄳ
─┐╭╮
 │││
 │││

ㄵ
╷ ──
│ ╱│
└─╵╵

ㄶ
│ ──
│ ──
└─()

ㄺ
─┐─┐
┌┘ │
└─ ╵

ㄻ
─┐┌┐
┌┘││
└─└┘

ㄼ
─┐╷╷
┌┘├┤
└─└┘

ㄽ
─┐╭╮
┌┘││
└─╵╵

ㄾ
─┐┌─
┌┘├─
└─└─

ㄿ
─┐┬┬
┌┘││
└─┴┴

ㅀ
─┐──
┌┘──
└─()

Example input and output

1한2글3날

 __ |   ---.  │   │
____|_     :  │   ├─
 () |      :  └── │
    |   ----      │
 |      ---.   ───┐
 |      .--'   ┌──┘
 |__    '---   └───

뛟쀒3쫽

 _ _||  ||||||  ────│ │
| | ||  [][]||  ╱│╱││ │
|_|_||  """"||  ││││├─┤
____||  ____||   ╷  │ │
 |--||   |--||  ─┴──│ │
 _ __    _ __    ─┐─┐
  ]__     ]][    ┌┘ │
 [_()    [_""    └─ ╵

Scoring

This is , so shortest code with length wins.

\$\endgroup\$
  • \$\begingroup\$ I was about to say something criticizing the three different styles, but come to think of if they could actually result in some very interesting compression techniques. \$\endgroup\$ – Unrelated String Oct 9 at 1:00
  • \$\begingroup\$ Wow I am impressed with the language and thanks for explaining about the consonant/vowel system, interesting stuff. But this challenge still seems too complicated. :O \$\endgroup\$ – Mitch McMabers Oct 9 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.