헤어 크리슈나 헤어 크리슈나 크리슈나 크리슈나 헤어 Krishna Hare Krishna Krishna

최근에 나는 엠블럼에 그들의 진언을 가진 Hare Krishna 사람들을 보았고 골프를 코딩하는 것이 꽤 흥미로울 수 있다는 것을 알았습니다.

도전

Hare Krishna 만트라를 작성하십시오 .

Hare Krishna Hare Krishna
Krishna Krishna Hare Hare
Hare Rama Hare Rama
Rama Rama Hare Hare

우승 기준

이것은 이므로 바이트 단위의 가장 짧은 코드가 이깁니다!

규칙

  • 케이싱은 보존해야합니다.
  • 텍스트는 줄 바꾸기를 포함해야합니다.
  • 줄 뒤에 공백이있을 수 있습니다.
  • 후행 줄 바꿈이 허용됩니다.
  • 웹 또는 기타 외부 리소스에서 구문 분석 할 수 없습니다.


답변

젤리 , 22 바이트

“t,ȧṫÞċḅ»Ḳ“¡¥Ɓc’ṃs4K€Y

온라인으로 사용해보십시오!

작동 원리

“t,ȧṫÞċḅ»Ḳ“¡¥Ɓc’ṃs4K€Y  Main link. No arguments.

“t,ȧṫÞċḅ»               Use Jelly's dictionary to yield the string
                        "Hare Rama Krishna". Fortunately, the words Rama, Krishna,
                        and hare (lowercase H) are in the dictionary.
         Ḳ              Split at spaces, yielding ["Hare", "Rama", "Krishna"].
          “¡¥Ɓc’        Base-250 literal; yielding 15973600.
                ṃ       Convert 15973600 to base ["Hare", "Rama", "Krishna"]
                        (ternary), where "Krishna" = 0, "Hare" = 1, and "Rama" = 2.
                 s4     Split the resulting string array into chunks of length 4.
                   K€   Join each of the four chunks by spaces.
                     Y  Join the resulting strings by linefeeds.

답변

05AB1E , 38 바이트

후행 줄 바꿈이 올 바르면 2 바이트 단축 될 수 있습니다.

“«Î‡Ä¦í¥Â“#€¦`«'kì)™ð«•2ÍZì•3BSè#4ô¨»?

온라인으로 사용해보십시오!

설명

“«Î‡Ä¦í¥Â“                              # push the string "drama share irish dna"
          #                             # split on spaces
           €¦                           # remove the first character of each word
             `                          # split to stack as separate words
              «'kì                      # concatenate the last 2 and prepend "k"
                  )™                    # wrap in list and title-case
                    ð«                  # append a space to each
                      •2ÍZì•            # push 27073120
                            3B          # convert to base-3: 1212221110100011
                              Sè        # index into the list with each
                                #       # split on spaces
                                 4ô     # split into pieces of 4
                                   ¨    # remove the last
                                    »   # join on spaces and newlines
                                     ?  # print without newline

답변

파이썬 2 , 60 바이트

a="Hare"
for x in"Krishna","Rama":print a,x,a,x+'\n',x,x,a,a

온라인으로 사용해보십시오!

이것은 이 시도와 같은 템플릿 교체 접근법을 능가하는 것 같습니다 .


답변

옥타브, 74 59 바이트

[{'Hare ','Krishna ','Rama ',10}{'ababdbbaadacacdccaa'-96}]

여기서 출력을 확인하십시오 .

설명:

{'Hare ','Krishna ','Rama ',10}세 번째 문자열로 셀형 배열을 작성합니다. 네 번째는 10(줄 바꿈의 ASCII 값)입니다.

{'ababdbbaadacacdccaa'-96}위의 셀형 배열을 인덱싱하는 벡터입니다. 벡터는 문자열에서 [1 2 1 2 4 ...]빼기 때문 입니다.96ababd...

주변 대괄호는 결과를 연결하는 데 사용됩니다. ans = Hare; and = Krishna; ans = ...


답변

망막 , 39 바이트


hkhk¶kkhh
h
Hare
*`k
Krishna
k
Rama

온라인으로 사용해보십시오!

대체로 일반 대체 인 유일한 “트릭”은 *대체 결과를 인쇄 한 다음 문자열을 이전 상태로 되 돌리는 수정 자 입니다.


답변

PHP, 61 바이트

<?=strtr("0101
1100
0202
2200",["Hare ","Krishna ","Rama "]);

배열의 키로 숫자에서 strtr 값으로 간단히 대체 하십시오.

온라인으로 사용해보십시오!


답변

자바 스크립트, 75 70 바이트

`0101
1100
0202
2200`.replace(/./g,n=>['Hare ','Krishna ','Rama '][n])

온라인으로 사용해보십시오!

console.log(`0101
1100
0202
2200`.replace(/./g,n=>['Hare ','Krishna ','Rama '][n]))