Make a Number Expression is related : actually, it is also about Aheui. But it just made number expression, but this made real Aheui code.
Aheui is esolang written in only Korean character. Because of its nature, Aheui can't use Arabic numbers.
But, of course, there is way to generate number.
Brief introduction to Aheui
Reading the link above is best, but put it shortly : Aheui is befunge-like esolang : have cursor, every character is instructor, and using stack.
One instructor, looks like 박
, have three part : Initial consonantㅂ
, vowelㅏ
, final consonantㄱ
.
First part, initial consonant, determine what to do.
Here is table of initial consonant that can be useful here:
ㅇ
: no operation.ㅎ
: terminate.ㄷ
: pop two number from current stack, than add them, and push to current stack.ㄸ
: same asㄷ
, but multiply instead of add.ㄴ
: pop two number from current stack, pushsecond // first
to current stack.ㅌ
: same asㄴ
, but subtract instead of divide.ㄹ
: same asㄴ
, but modulo instead of divide.ㅂ
: push number to current stack. Number is given by final consonant.ㅃ
: duplicate top of current stack.ㅍ
: swap top two value of current stack.
Second part, vowel, determine momentum. Maybe you just need ㅏ
, go to next.
Last part, final consonant, determine number to used in ㅂ
commend.
Here is list of final consonant and number.
- Nothing
ㄱ
,ㄴ
,ㅅ
ㄷ
,ㅈ
,ㅋ
ㅁ
,ㅂ
,ㅊ
,ㅌ
,ㅋ
,ㄲ
,ㄳ
,ㅆ
ㄹ
,ㄵ
,ㄶ
ㅄ
ㄺ
,ㄽ
ㅀ
ㄻ
,ㄼ
Finally, 망
is printing operator. Your code have to print 망희
or 망하
or whatever after calculation, to print and terminate the program.
Korean Character
Every Aheui instructor is Korean character.
As I mentioned above, Korean character has three part : Initial consonant(choseong
or 초성
), Vowel(jungseong
or 중성
), Final consonant(jongseong
or 종성
).
Every character has initial consonant and vowel, but final consonant is option.
Korean character in Unicode is from AC00
(가
) to D7A3
(힣
).
For composing Korean character, look at this webpage for help.
Question
Input is an positive integer. Generate aheui code that prints given integer, without hardcode every possibility.
You can test your Aheui code at try it online.
Examples
Input | Output | Discription
1 | 반밧나망희 | Put two 2s in stack, divide, print, and halt.
1 | 반반나망희 | Same as above.
1 | 밪반타망희 | Put 3 then 2 in stack, subtract, print, and halt.
3 | 받망희 | Put 3 in stack, print, halt.
3 | 반밧나빠빠다다망희 | Put two 2s in stack, divide, duplicate two times, add two times, print, halt. This is OK, but won't get good point.
72 | 밢밣따망희 | Put 8 and 9 in stack, multiply, print, and halt.
10 | 박밙따망희 | Put 2 and 5 in stack, multiply, print, and halt.
Scoring
Average length of 101 Aheui codes that prints 100 to 200. If score is same, shorter code wins.