Houndstooth 패턴 그리기


22

두 개의 양의 정수, 너비와 높이를 사용하는 프로그램이나 함수를 작성 하고이 25 × 26 텍스트 격자를 기본 셀로 사용하여 치수 가있는 ASCII 아트 houndstooth 격자 패턴을 그 립니다 .

.......#.....#####.......
.......##.....#####......
.......###.....#####.....
.......####.....####.....
.......#####.....###.....
.......######.....##.....
.......#######.....#.....
.......########..........
####################.....
.####################....
..####################...
...####################..
....####################.
.....####################
#.....##############.####
##.....#############..###
###....#############...##
####...#############....#
#####..#############.....
.#####.#############.....
..##################.....
........#####............
.........#####...........
..........#####..........
...........#####.........
............#####........

따라서 입력이 2,1출력이면 다음과 같습니다.

.......#.....#####..............#.....#####.......
.......##.....#####.............##.....#####......
.......###.....#####............###.....#####.....
.......####.....####............####.....####.....
.......#####.....###............#####.....###.....
.......######.....##............######.....##.....
.......#######.....#............#######.....#.....
.......########.................########..........
####################.....####################.....
.####################.....####################....
..####################.....####################...
...####################.....####################..
....####################.....####################.
.....####################.....####################
#.....##############.#####.....##############.####
##.....#############..#####.....#############..###
###....#############...#####....#############...##
####...#############....#####...#############....#
#####..#############.....#####..#############.....
.#####.#############......#####.#############.....
..##################.......##################.....
........#####....................#####............
.........#####....................#####...........
..........#####....................#####..........
...........#####....................#####.........
............#####....................#####........

그리고 입력이 5,4출력이라면 :

.......#.....#####..............#.....#####..............#.....#####..............#.....#####..............#.....#####.......
.......##.....#####.............##.....#####.............##.....#####.............##.....#####.............##.....#####......
.......###.....#####............###.....#####............###.....#####............###.....#####............###.....#####.....
.......####.....####............####.....####............####.....####............####.....####............####.....####.....
.......#####.....###............#####.....###............#####.....###............#####.....###............#####.....###.....
.......######.....##............######.....##............######.....##............######.....##............######.....##.....
.......#######.....#............#######.....#............#######.....#............#######.....#............#######.....#.....
.......########.................########.................########.................########.................########..........
####################.....####################.....####################.....####################.....####################.....
.####################.....####################.....####################.....####################.....####################....
..####################.....####################.....####################.....####################.....####################...
...####################.....####################.....####################.....####################.....####################..
....####################.....####################.....####################.....####################.....####################.
.....####################.....####################.....####################.....####################.....####################
#.....##############.#####.....##############.#####.....##############.#####.....##############.#####.....##############.####
##.....#############..#####.....#############..#####.....#############..#####.....#############..#####.....#############..###
###....#############...#####....#############...#####....#############...#####....#############...#####....#############...##
####...#############....#####...#############....#####...#############....#####...#############....#####...#############....#
#####..#############.....#####..#############.....#####..#############.....#####..#############.....#####..#############.....
.#####.#############......#####.#############......#####.#############......#####.#############......#####.#############.....
..##################.......##################.......##################.......##################.......##################.....
........#####....................#####....................#####....................#####....................#####............
.........#####....................#####....................#####....................#####....................#####...........
..........#####....................#####....................#####....................#####....................#####..........
...........#####....................#####....................#####....................#####....................#####.........
............#####....................#####....................#####....................#####....................#####........
.......#.....#####..............#.....#####..............#.....#####..............#.....#####..............#.....#####.......
.......##.....#####.............##.....#####.............##.....#####.............##.....#####.............##.....#####......
.......###.....#####............###.....#####............###.....#####............###.....#####............###.....#####.....
.......####.....####............####.....####............####.....####............####.....####............####.....####.....
.......#####.....###............#####.....###............#####.....###............#####.....###............#####.....###.....
.......######.....##............######.....##............######.....##............######.....##............######.....##.....
.......#######.....#............#######.....#............#######.....#............#######.....#............#######.....#.....
.......########.................########.................########.................########.................########..........
####################.....####################.....####################.....####################.....####################.....
.####################.....####################.....####################.....####################.....####################....
..####################.....####################.....####################.....####################.....####################...
...####################.....####################.....####################.....####################.....####################..
....####################.....####################.....####################.....####################.....####################.
.....####################.....####################.....####################.....####################.....####################
#.....##############.#####.....##############.#####.....##############.#####.....##############.#####.....##############.####
##.....#############..#####.....#############..#####.....#############..#####.....#############..#####.....#############..###
###....#############...#####....#############...#####....#############...#####....#############...#####....#############...##
####...#############....#####...#############....#####...#############....#####...#############....#####...#############....#
#####..#############.....#####..#############.....#####..#############.....#####..#############.....#####..#############.....
.#####.#############......#####.#############......#####.#############......#####.#############......#####.#############.....
..##################.......##################.......##################.......##################.......##################.....
........#####....................#####....................#####....................#####....................#####............
.........#####....................#####....................#####....................#####....................#####...........
..........#####....................#####....................#####....................#####....................#####..........
...........#####....................#####....................#####....................#####....................#####.........
............#####....................#####....................#####....................#####....................#####........
.......#.....#####..............#.....#####..............#.....#####..............#.....#####..............#.....#####.......
.......##.....#####.............##.....#####.............##.....#####.............##.....#####.............##.....#####......
.......###.....#####............###.....#####............###.....#####............###.....#####............###.....#####.....
.......####.....####............####.....####............####.....####............####.....####............####.....####.....
.......#####.....###............#####.....###............#####.....###............#####.....###............#####.....###.....
.......######.....##............######.....##............######.....##............######.....##............######.....##.....
.......#######.....#............#######.....#............#######.....#............#######.....#............#######.....#.....
.......########.................########.................########.................########.................########..........
####################.....####################.....####################.....####################.....####################.....
.####################.....####################.....####################.....####################.....####################....
..####################.....####################.....####################.....####################.....####################...
...####################.....####################.....####################.....####################.....####################..
....####################.....####################.....####################.....####################.....####################.
.....####################.....####################.....####################.....####################.....####################
#.....##############.#####.....##############.#####.....##############.#####.....##############.#####.....##############.####
##.....#############..#####.....#############..#####.....#############..#####.....#############..#####.....#############..###
###....#############...#####....#############...#####....#############...#####....#############...#####....#############...##
####...#############....#####...#############....#####...#############....#####...#############....#####...#############....#
#####..#############.....#####..#############.....#####..#############.....#####..#############.....#####..#############.....
.#####.#############......#####.#############......#####.#############......#####.#############......#####.#############.....
..##################.......##################.......##################.......##################.......##################.....
........#####....................#####....................#####....................#####....................#####............
.........#####....................#####....................#####....................#####....................#####...........
..........#####....................#####....................#####....................#####....................#####..........
...........#####....................#####....................#####....................#####....................#####.........
............#####....................#####....................#####....................#####....................#####........
.......#.....#####..............#.....#####..............#.....#####..............#.....#####..............#.....#####.......
.......##.....#####.............##.....#####.............##.....#####.............##.....#####.............##.....#####......
.......###.....#####............###.....#####............###.....#####............###.....#####............###.....#####.....
.......####.....####............####.....####............####.....####............####.....####............####.....####.....
.......#####.....###............#####.....###............#####.....###............#####.....###............#####.....###.....
.......######.....##............######.....##............######.....##............######.....##............######.....##.....
.......#######.....#............#######.....#............#######.....#............#######.....#............#######.....#.....
.......########.................########.................########.................########.................########..........
####################.....####################.....####################.....####################.....####################.....
.####################.....####################.....####################.....####################.....####################....
..####################.....####################.....####################.....####################.....####################...
...####################.....####################.....####################.....####################.....####################..
....####################.....####################.....####################.....####################.....####################.
.....####################.....####################.....####################.....####################.....####################
#.....##############.#####.....##############.#####.....##############.#####.....##############.#####.....##############.####
##.....#############..#####.....#############..#####.....#############..#####.....#############..#####.....#############..###
###....#############...#####....#############...#####....#############...#####....#############...#####....#############...##
####...#############....#####...#############....#####...#############....#####...#############....#####...#############....#
#####..#############.....#####..#############.....#####..#############.....#####..#############.....#####..#############.....
.#####.#############......#####.#############......#####.#############......#####.#############......#####.#############.....
..##################.......##################.......##################.......##################.......##################.....
........#####....................#####....................#####....................#####....................#####............
.........#####....................#####....................#####....................#####....................#####...........
..........#####....................#####....................#####....................#####....................#####..........
...........#####....................#####....................#####....................#####....................#####.........
............#####....................#####....................#####....................#####....................#####........
  • 너비 인수가 먼저 와야합니다. 합리적인 입력 형식 (예를 들어 w,h, w h, (w, h)) 미세하다.
  • 선택적인 후행 줄 바꿈으로 결과를 인쇄하거나 반환하십시오.
  • 및 대신에 두 개의 고유 한 인쇄 가능한 ASCII 문자를 사용할 수 있습니다 ..#
  • 기본 경계 조건 이있는 것처럼 기본 셀을 세로 또는 가로로 변환 할 수 있습니다 . 따라서 출력의 왼쪽 상단 모서리가 반드시 7x8 사각형 일 필요는 없습니다 .. ( 새로운 규칙! )

바이트 단위의 가장 짧은 코드가 이깁니다.

보너스로, 각각 .이 한 색상 #의 픽셀 이고 각각 이 다른 색상의 픽셀 인 이미지를 생성하십시오 .


어떤 종류의 보너스? 쿠키 ..? ;-)
Zach Gates

4
"가장 짧은 코드 승리"를 조이십시오.
El'endia Starman

7
@ZachGates 개 비스킷 일 수도 있습니다.
Calvin 's Hobbies

그것에 조수를 굴리십시오!
Greg Bacon

답변:


17

Pyth, 61 60 55 49 바이트

j*vwmjk*Qd++Rm012Jmms}k++Rhd5U-d4T=T13+Lm1T_mP_dJ

온라인으로 사용해보십시오 : 데모

편집 1 : 밴드와 삼각형을 생성하는 두 문장을 결합하십시오 (아래 참조)

편집 2 : 어떤 기호도 사용할 수 없다는 것을 보지 못했습니다. 저장된 5 바이트 편집

편집 3 : @ Calvin'sHobbies는 기본 이미지를 번역 할 수있었습니다. 내 접근 방식은이 아이디어를 기반으로 했으므로 상당히 도움이되었습니다. -6 바이트

그리고 쿠키 보너스 :

.w*vw*RQ++Rm012Jmm*K255}k++Rhd5U-d4T=T13+LmKT_mP_dJ

이것은 2 바이트 만 더 길고 (51 바이트) 파일을 생성합니다 o.png. 입력의 5\n4경우 다음 그림이 생성됩니다.

물떼새 격자 패턴

설명:

Houndstooth 패턴은 매우 불규칙적으로 보입니다. 그러나 왼쪽 7 열을 오른쪽으로 가져오고 상위 5 행을 바닥으로 가져 오면 훨씬 더 좋은 패턴을 얻습니다.

.#####...................
..#####..................
...#####.................
....#####................
.....#####...............
#.....#####..............
##.....#####.............
###.....#####............
####.....####............
#####.....###............
######.....##............
#######.....#............
########.................
#############.....#######
##############.....######
###############.....#####
################.....####
#################.....###
##################.....##
#############.#####.....#
#############..#####.....
#############...#####....
#############....#####...
#############.....#####..
#############......#####.
#############.......#####

먼저 왼쪽 상단 13x13 블록을 만듭니다.

.#####.......
..#####......
...#####.....
....#####....
.....#####...
#.....#####..
##.....#####.
###.....#####
####.....####
#####.....###
######.....##
#######.....#
########.....

#영역 을 설명하는 두 가지 간단한 불평등이 있습니다 . 밴드는로 기술 될 수 있고 y + 1 <= x <= y + 5삼각형은로 기술 될 수있다 x <= y - 5. 이 두 가지 조건을 결합했습니다.

Jmms}k++Rhd5U-d4T=T13
                 =T13   T = 13
 m               T      map each d of [0, 1, ..., 12] to: 
                           the list produced by
  m             T          map each k of [0, 1, ..., 12] to:
       +Rhd5                  the list [d+1, d+2, ..., d+5]
      +                       extended by 
            U-d4              the list [0, 1, ..., d - 5]
    }k                        test if k is in the list
   s                          and convert the boolean result to 1 or 0
J                       assign this 13x13 block to J

그런 다음 +Rm012각 행의 끝에 12 개의 0을 추가하여 상위 25x13 블록을 얻습니다.

하위 25x13 블록은 이제 정말 간단합니다.

+Lm1T_mP_dJ
      m   J    map each row d of J to:
       P_d        reverse the row and pop the last element
     _         reverse the order the rows
+Lm1T          add T ones at the beginning of each row. 

이제 남은 것은 패턴을 반복하고 인쇄하는 것입니다

j*vwmjk*Qd+upperlower   implicit: Q = first input number
          +upperlower   combine the two blocks to a 25x26 block
    m                   map each row d to:
       *Qd                 repeat d Q times
     jk                    and join to a string
 *vw                    read another number from input and repeat
j                       join by newlines and print

쿠키 보너스 코드 와의 차이점 :

  • 255 대신에 1
  • 문자열을 원하지 않기 때문에 대신을 mjk*Qd사용하십시오 *RQ.
  • .w 이 2D 배열을 파일로 저장합니다 (암시 적으로 png로 변환)

5
환상적인 설명!
trichoplax

당신은 분명히 "맨 아래 5 줄"을 의미합니다. 오타 일뿐입니다. 조치를 취하지 않고 내 댓글이 삭제 된 이유를 모르겠습니다. 결과적으로 나는 지금 당신의 게시물을 직접 편집하고 부끄러워합니다. 대체로 아주 좋은 답변과 훌륭한 설명입니다. 나는 전에 그것을 이미 upvoted
Level River St

@steveverrill 아, 죄송합니다. 나는 당신이 구절에서 나의 영어를 교정하고 싶다고 생각했는데, 여기서 나는 변형을 다시 설명했습니다. 지금 고쳤습니다. 감사.
Jakube

11

CJam, 106 73 71 바이트

0000000: 71 7e 22 04 94 51 af 40 6e 73 b2 68 3a e1 7e 13 f2 a1  q~"..Q.@ns.h:.~...
0000012: 3e 1d de f5 64 9c 6b 0f 27 4c 36 d7 81 3d 30 35 56 f8  >...d.k.'L6..=05V.
0000024: cd e8 cd 7c dc 90 31 59 40 8b 8c 22 32 35 36 62 32 32  ...|..1Y@.."256b22
0000036: 62 41 73 33 39 2a 2e 2a 73 32 35 2f 2a 66 2a 4e 2a     bAs39*.*s25/*f*N*

인쇄 10대신 .하고 #. CJam 통역사 에서 온라인으로 사용해보십시오 .

작동 원리

q~      e# Read and evaluate all input. This pushes W and H.
"…"     e# Push an encoding of run lengths of the characters in the output.
256b22b e# Convert from base 256 to base 22.
As39*   e# Push "10" and repeat it 39 times.
.*      e# Vectorized character repetition; multiply each base 22 digit (run
        e# length) by the corresponding character of "10…10".
s25/    e# Flatten and split into chunks of length 25.
*       e# Repeat the resulting array of rows H times.
f*      e# Repeat each row W times.
N*      e# Join the rows, separating by linefeeds.

쿠키 보너스

0000000: 27 50 6f 31 70 71 7e 5d 5f 5b 32 35 5f 29 5d 2e 2a 5c  'Po1pq~]_[25_)].*\
0000012: 7e 22 04 94 51 af 40 6e 73 b2 68 3a e1 7e 13 f2 a1 3e  ~"..Q.@ns.h:.~...>
0000024: 1d de f5 64 9c 6b 0f 27 4c 36 d7 81 3d 30 35 56 f8 cd  ...d.k.'L6..=05V..
0000036: e8 cd 7c dc 90 31 59 40 8b 8c 22 32 35 36 62 32 32 62  ..|..1Y@.."256b22b
0000048: 41 73 33 39 2a 2e 2a 73 32 35 2f 2a 66 2a 73 2b 4e 2a  As39*.*s25/*f*s+N*

ASCII 아트 대신 휴대용 BitMap을 인쇄합니다.

아래는 input 출력이며 24 13PNG로 변환됩니다.

산출


7

Befunge-93 , 2120 1967 바이트

디버깅을위한 예외 처리 기능을 갖춘 고품질의 기능이 있습니다!

&&00p10pv
v       <
    >94+2*20p        v
>00g|   >                v
    @                >10g>0020gv-1:<
                               >:0`|
                     ,       v    $<
                     +        >v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v
 v_$1-:#^_$20g1-20p55^       >|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>"!DAB"....@
 ,:
 >^".......#.....#####......."                                                    <
  ^".......##.....#####......"                                                  <
  ^".......###.....#####....."                                                <
  ^".......####.....####....."                                              <
  ^".......#####.....###....."                                            <
  ^".......######.....##....."                                          <
  ^".......#######.....#....."                                        <
  ^".......########.........."                                      <
  ^"####################....."                                    <
  ^".####################...."                                  <
  ^"..####################..."                                <
  ^"...####################.."                              <
  ^"....####################."                            <
  ^".....####################"                          <
  ^"#.....##############.####"                        <
  ^"##.....#############..###"                      <
  ^"###....#############...##"                    <
  ^"####...#############....#"                  <
  ^"#####..#############....."                <
  ^".#####.#############....."              <
  ^"..##################....."            <
  ^"........#####............"          <
  ^".........#####..........."        <
  ^"..........#####.........."      <
  ^"...........#####........."    <
  ^"............#####........"  <
^                     p00-1g00<

(분명히, 이것은 여전히 ​​골프 가능합니다. 지금 당장 여기에 답변을 원했습니다)

그래서 이것은 다른 부분으로 구성됩니다.

&&00p10p

이것은 이니셜 라이저 일 뿐이며 값을 받아서 저장합니다.

    >94+2*20p
>00g|      > 
    @  

이 섹션에서는 행 수를 재설정하므로 다른 (너비) 사진을 나란히 인쇄 할 수 있습니다. 94+2*26, 행 수를 계산 중입니다. 또한 높이가 0이면 프로그램이 종료됩니다.

>10g

스택의 너비를 가져 와서 인쇄 할 수를 알 수 있습니다.

0020gv-1:<
     >:0`|
         $

스택에 두 개의 더미 값을 추가하여 작업 완료 시점과 현재 행 (n)을 알려줍니다. 그런 다음 스택에 n 값을 추가합니다

>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v
|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>"!DAB"....@

                                                    <
                                                  <
                                                <
                                              <
                                            <
                                          <
                                        <
                                      <
                                    <
                                  <
                                <
                              <
                            <
                          <
                        <
                      <
                    <
                  <
                <
              <
            <
          <
        <
      <
    <
  <
<

이것은 (26-n) 행으로가는 제어 섹션입니다. 이것이 내가하는 방법을 알아낼 수있는 가장 쉬운 방법입니다.

".......#.....#####......."
".......##.....#####......"
".......###.....#####....."
".......####.....####....."
".......#####.....###....."
".......######.....##....."
".......#######.....#....."
".......########.........."
"####################....."
".####################...."
"..####################..."
"...####################.."
"....####################."
".....####################"
"#.....##############.####"
"##.....#############..###"
"###....#############...##"
"####...#############....#"
"#####..#############....."
".#####.#############....."
"..##################....."
"........#####............"
".........#####..........."
"..........#####.........."
"...........#####........."
"............#####........"

이것은 분명히 읽히고 스택에 읽은 행을 뒤로 뒤집습니다. 이것은 우리가 튀어 나오면 올바르게 인쇄됨을 의미합니다.

v_
,:
>^

스택이 0에 도달 할 때까지 인쇄합니다.

1-:#^_

인쇄 할 특정 줄 번호에서 1을 빼고 0인지 확인합니다. 0이 아닌 경우 코드의 네 번째 블록으로 돌아갑니다.

          ,
          +
20g1-20p55^

행 (n)에서 1을 빼고 줄 바꿈을 인쇄하고 블록 3으로 돌아갑니다.

p00-1g00

모든 행이 인쇄되면 초기 높이에서 하나를 빼고 블록 2로 돌아갑니다.

나머지 코드는 모두 제어 흐름 또는 스택 관리입니다. 내가 생각했던 것보다 더 많이이 마스를 쓰지만, 그 모습에 만족합니다. 훨씬 더 골프화가 가능하며, 하루 더 프로젝트로 남을 것입니다.

2120-> 1967 : 낭비되는 공간이 많은 일부 줄을 자릅니다.


1
나는 골프를 쳤다. 귀하의 답변은 아니지만 Befunge에서 솔루션을 골퍼했습니다!
El'endia Starman

6

펄, 243

( -n스위치가 stdin에서 입력을 가져 오기 위해 1 바이트가 추가되었습니다 .)

($w,$h)=split;for(1..$h){print((sprintf("%025b",hex)x$w).$/)foreach qw(20f80 307c0 383e0 3c1e0 3e0e0 3f060 3f820 3fc00 1ffffe0 fffff0 7ffff8 3ffffc 1ffffe fffff 107ffef 183ffe7 1c3ffe3 1e3ffe1 1f3ffe0 fbffe0 7fffe0 1f000 f800 7c00 3e00 1f00)}

이것은 매우 간단합니다. 26 개의 16 진수 배열을 이진수로 변환하고 필요한 횟수만큼 인쇄하면됩니다.

예:

입력:

3 2

산출:

000000010000011111000000000000001000001111100000000000000100000111110000000
000000011000001111100000000000001100000111110000000000000110000011111000000
000000011100000111110000000000001110000011111000000000000111000001111100000
000000011110000011110000000000001111000001111000000000000111100000111100000
000000011111000001110000000000001111100000111000000000000111110000011100000
000000011111100000110000000000001111110000011000000000000111111000001100000
000000011111110000010000000000001111111000001000000000000111111100000100000
000000011111111000000000000000001111111100000000000000000111111110000000000
111111111111111111110000011111111111111111111000001111111111111111111100000
011111111111111111111000001111111111111111111100000111111111111111111110000
001111111111111111111100000111111111111111111110000011111111111111111111000
000111111111111111111110000011111111111111111111000001111111111111111111100
000011111111111111111111000001111111111111111111100000111111111111111111110
000001111111111111111111100000111111111111111111110000011111111111111111111
100000111111111111110111110000011111111111111011111000001111111111111101111
110000011111111111110011111000001111111111111001111100000111111111111100111
111000011111111111110001111100001111111111111000111110000111111111111100011
111100011111111111110000111110001111111111111000011111000111111111111100001
111110011111111111110000011111001111111111111000001111100111111111111100000
011111011111111111110000001111101111111111111000000111110111111111111100000
001111111111111111110000000111111111111111111000000011111111111111111100000
000000001111100000000000000000000111110000000000000000000011111000000000000
000000000111110000000000000000000011111000000000000000000001111100000000000
000000000011111000000000000000000001111100000000000000000000111110000000000
000000000001111100000000000000000000111110000000000000000000011111000000000
000000000000111110000000000000000000011111000000000000000000001111100000000
000000010000011111000000000000001000001111100000000000000100000111110000000
000000011000001111100000000000001100000111110000000000000110000011111000000
000000011100000111110000000000001110000011111000000000000111000001111100000
000000011110000011110000000000001111000001111000000000000111100000111100000
000000011111000001110000000000001111100000111000000000000111110000011100000
000000011111100000110000000000001111110000011000000000000111111000001100000
000000011111110000010000000000001111111000001000000000000111111100000100000
000000011111111000000000000000001111111100000000000000000111111110000000000
111111111111111111110000011111111111111111111000001111111111111111111100000
011111111111111111111000001111111111111111111100000111111111111111111110000
001111111111111111111100000111111111111111111110000011111111111111111111000
000111111111111111111110000011111111111111111111000001111111111111111111100
000011111111111111111111000001111111111111111111100000111111111111111111110
000001111111111111111111100000111111111111111111110000011111111111111111111
100000111111111111110111110000011111111111111011111000001111111111111101111
110000011111111111110011111000001111111111111001111100000111111111111100111
111000011111111111110001111100001111111111111000111110000111111111111100011
111100011111111111110000111110001111111111111000011111000111111111111100001
111110011111111111110000011111001111111111111000001111100111111111111100000
011111011111111111110000001111101111111111111000000111110111111111111100000
001111111111111111110000000111111111111111111000000011111111111111111100000
000000001111100000000000000000000111110000000000000000000011111000000000000
000000000111110000000000000000000011111000000000000000000001111100000000000
000000000011111000000000000000000001111100000000000000000000111110000000000
000000000001111100000000000000000000111110000000000000000000011111000000000
000000000000111110000000000000000000011111000000000000000000001111100000000

3

개정 1, C, 118115 바이트

i,x,y;f(w,h){for(i=26*h*(w*=25);i--;i%w||puts(""))x=i%25,y=i/w%26,putchar(((y>x^y>x+5^x>y+4)&y/13==x/13^y/13)+34);}

셀 변환을 허용하는 새로운 규칙으로 인해 9 바이트가 절약되었습니다. 을 사용하여 3 바이트를 절약했습니다 w*=25. 나머지 게시물은 변경되지 않습니다.

개정 0, C, 127 바이트

i,x,y;f(w,h){for(i=650*w*h;i--;i%(25*w)||puts(""))x=(i+20)%25,y=(i/25/w+8)%26,putchar(((y>x^y>x+5^x>y+4)&y/13==x/13^y/13)+34);}

이것은 문자를 통해 하나씩 인쇄합니다. i%(25*w)||puts("")각 줄의 끝에 줄 바꿈을 삽입합니다.

디자인을 보는 방식은 Jakube와 비슷하지만 맨 아래 8 개 행을 맨 아래에, 오른쪽 5 개 열을 왼쪽으로 가져와 다음과 같은보기를 얻습니다. 이 단계는 프로그램에 의해 "반전" +20+8X 및 Y에 대한 식이다.

"""""####################
#"""""###################
##"""""##################
###"""""#################
####"""""################
#####"""""###############
"#####"""""##############
""#####"""""#############
"""#####""""#############
""""#####"""#############
"""""#####""#############
""""""#####"#############
"""""""##################
"""""""""""""#####"""""""
""""""""""""""#####""""""
"""""""""""""""#####"""""
""""""""""""""""#####""""
"""""""""""""""""#####"""
""""""""""""#"""""#####""
""""""""""""##"""""#####"
""""""""""""###"""""#####
""""""""""""####"""""####
""""""""""""#####"""""###
""""""""""""######"""""##
""""""""""""#######"""""#
""""""""""""########"""""

"색의 반전"외에도 매우 비슷하게 보일 수 있지만 중요한 차이점이 있습니다. 대각선 줄무늬가 일치합니다. (원래 디자인은 25x26 크기이므로 대각선 대칭이 없습니다.)

이 표현식 ((y>x^y>x+5^x>y+4)^y/13)+34은 다양한 비교 연산자가 스트라이프를 ^y/13생성하고 "컬러 플립"을 반쯤 올린 +34다음 결과 수를 가져 와서 0,1ASCII 범위로 올립니다 34,35.

"""""####################
#"""""###################
##"""""##################
###"""""#################
####"""""################
#####"""""###############
"#####"""""##############
""#####"""""#############
"""#####"""""############
""""#####"""""###########
"""""#####"""""##########
""""""#####"""""#########
"""""""#####"""""########
########"""""#####"""""""
#########"""""#####""""""
##########"""""#####"""""
###########"""""#####""""
############"""""#####"""
#############"""""#####""
##############"""""#####"
###############"""""#####
################"""""####
#################"""""###
##################"""""##
###################"""""#
####################"""""

이 용어 &y/13==x/13는 오른쪽 상단과 왼쪽 하단에서 false = 0으로 평가되어 이전에 표시된대로 패턴의 사각형 부분을 생성합니다. 프로그램이 카운트 다운하기 때문에 원점 x = y = 0이 오른쪽 아래에 있습니다. 제곱의 #너비는 13 자이고 제곱의 너비는 12 자 이므로 편리합니다 ".


2

Befunge -93, 968 바이트

네 맞습니다! 경쟁 Befunge 답변!

&:&\00p10p:520pv:g00p02<v  <
    #   p1*45-1_v#:" "  <  v
    |`-1*65:g02$<      ,
    >:" "\39*\p:" "\47 *v
+:"<"\39*\p:"v"\47*\p25^>\p 1
".......#.....#####......."<v
".......##.....#####......"
".......###.....#####....."
".......####.....####....."
".......#####.....###....."
".......######.....##....."
".......#######.....#....."
".......########.........."
"####################....."
".####################...."
"..####################..."
"...####################.."
"....####################."
".....####################"
"#.....##############.####"
"##.....#############..###"
"###....#############...##"
"####...#############....#"
"#####..#############....."
".#####.#############....."
"..##################....."
"........#####............"
".........#####..........."
"..........#####.........."
"...........#####........."
"............#####........"
,,,,,,,,,,,,,,,,,,,,,,,,,  v>
    > 10g1-:10p #v_@
 " " \47*\p5:"<"v>:" "\39*\ p
\*74 \"v":p\*93\<      v,*5 2p

내일 설명해 그러나 몇 가지 리디렉션 화살표를 이동하여 영리한 작업을 수행하고 랩 어라운드 속성도 상당히 사용한다고 말할 것입니다. 이 온라인 통역사 에서 테스트 해보십시오 .

당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.