Gambar Pola Houndstooth


22

Tulis program atau fungsi yang menggunakan dua bilangan bulat positif, lebar dan tinggi, dan gambar pola kisi houndstooth art ASCII dengan dimensi tersebut menggunakan kisi teks 25 × 26 ini sebagai sel dasar:

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

Jadi jika inputnya adalah 2,1output:

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

Dan jika inputnya adalah 5,4outputnya adalah:

.......#.....#####..............#.....#####..............#.....#####..............#.....#####..............#.....#####.......
.......##.....#####.............##.....#####.............##.....#####.............##.....#####.............##.....#####......
.......###.....#####............###.....#####............###.....#####............###.....#####............###.....#####.....
.......####.....####............####.....####............####.....####............####.....####............####.....####.....
.......#####.....###............#####.....###............#####.....###............#####.....###............#####.....###.....
.......######.....##............######.....##............######.....##............######.....##............######.....##.....
.......#######.....#............#######.....#............#######.....#............#######.....#............#######.....#.....
.......########.................########.................########.................########.................########..........
####################.....####################.....####################.....####################.....####################.....
.####################.....####################.....####################.....####################.....####################....
..####################.....####################.....####################.....####################.....####################...
...####################.....####################.....####################.....####################.....####################..
....####################.....####################.....####################.....####################.....####################.
.....####################.....####################.....####################.....####################.....####################
#.....##############.#####.....##############.#####.....##############.#####.....##############.#####.....##############.####
##.....#############..#####.....#############..#####.....#############..#####.....#############..#####.....#############..###
###....#############...#####....#############...#####....#############...#####....#############...#####....#############...##
####...#############....#####...#############....#####...#############....#####...#############....#####...#############....#
#####..#############.....#####..#############.....#####..#############.....#####..#############.....#####..#############.....
.#####.#############......#####.#############......#####.#############......#####.#############......#####.#############.....
..##################.......##################.......##################.......##################.......##################.....
........#####....................#####....................#####....................#####....................#####............
.........#####....................#####....................#####....................#####....................#####...........
..........#####....................#####....................#####....................#####....................#####..........
...........#####....................#####....................#####....................#####....................#####.........
............#####....................#####....................#####....................#####....................#####........
.......#.....#####..............#.....#####..............#.....#####..............#.....#####..............#.....#####.......
.......##.....#####.............##.....#####.............##.....#####.............##.....#####.............##.....#####......
.......###.....#####............###.....#####............###.....#####............###.....#####............###.....#####.....
.......####.....####............####.....####............####.....####............####.....####............####.....####.....
.......#####.....###............#####.....###............#####.....###............#####.....###............#####.....###.....
.......######.....##............######.....##............######.....##............######.....##............######.....##.....
.......#######.....#............#######.....#............#######.....#............#######.....#............#######.....#.....
.......########.................########.................########.................########.................########..........
####################.....####################.....####################.....####################.....####################.....
.####################.....####################.....####################.....####################.....####################....
..####################.....####################.....####################.....####################.....####################...
...####################.....####################.....####################.....####################.....####################..
....####################.....####################.....####################.....####################.....####################.
.....####################.....####################.....####################.....####################.....####################
#.....##############.#####.....##############.#####.....##############.#####.....##############.#####.....##############.####
##.....#############..#####.....#############..#####.....#############..#####.....#############..#####.....#############..###
###....#############...#####....#############...#####....#############...#####....#############...#####....#############...##
####...#############....#####...#############....#####...#############....#####...#############....#####...#############....#
#####..#############.....#####..#############.....#####..#############.....#####..#############.....#####..#############.....
.#####.#############......#####.#############......#####.#############......#####.#############......#####.#############.....
..##################.......##################.......##################.......##################.......##################.....
........#####....................#####....................#####....................#####....................#####............
.........#####....................#####....................#####....................#####....................#####...........
..........#####....................#####....................#####....................#####....................#####..........
...........#####....................#####....................#####....................#####....................#####.........
............#####....................#####....................#####....................#####....................#####........
.......#.....#####..............#.....#####..............#.....#####..............#.....#####..............#.....#####.......
.......##.....#####.............##.....#####.............##.....#####.............##.....#####.............##.....#####......
.......###.....#####............###.....#####............###.....#####............###.....#####............###.....#####.....
.......####.....####............####.....####............####.....####............####.....####............####.....####.....
.......#####.....###............#####.....###............#####.....###............#####.....###............#####.....###.....
.......######.....##............######.....##............######.....##............######.....##............######.....##.....
.......#######.....#............#######.....#............#######.....#............#######.....#............#######.....#.....
.......########.................########.................########.................########.................########..........
####################.....####################.....####################.....####################.....####################.....
.####################.....####################.....####################.....####################.....####################....
..####################.....####################.....####################.....####################.....####################...
...####################.....####################.....####################.....####################.....####################..
....####################.....####################.....####################.....####################.....####################.
.....####################.....####################.....####################.....####################.....####################
#.....##############.#####.....##############.#####.....##############.#####.....##############.#####.....##############.####
##.....#############..#####.....#############..#####.....#############..#####.....#############..#####.....#############..###
###....#############...#####....#############...#####....#############...#####....#############...#####....#############...##
####...#############....#####...#############....#####...#############....#####...#############....#####...#############....#
#####..#############.....#####..#############.....#####..#############.....#####..#############.....#####..#############.....
.#####.#############......#####.#############......#####.#############......#####.#############......#####.#############.....
..##################.......##################.......##################.......##################.......##################.....
........#####....................#####....................#####....................#####....................#####............
.........#####....................#####....................#####....................#####....................#####...........
..........#####....................#####....................#####....................#####....................#####..........
...........#####....................#####....................#####....................#####....................#####.........
............#####....................#####....................#####....................#####....................#####........
.......#.....#####..............#.....#####..............#.....#####..............#.....#####..............#.....#####.......
.......##.....#####.............##.....#####.............##.....#####.............##.....#####.............##.....#####......
.......###.....#####............###.....#####............###.....#####............###.....#####............###.....#####.....
.......####.....####............####.....####............####.....####............####.....####............####.....####.....
.......#####.....###............#####.....###............#####.....###............#####.....###............#####.....###.....
.......######.....##............######.....##............######.....##............######.....##............######.....##.....
.......#######.....#............#######.....#............#######.....#............#######.....#............#######.....#.....
.......########.................########.................########.................########.................########..........
####################.....####################.....####################.....####################.....####################.....
.####################.....####################.....####################.....####################.....####################....
..####################.....####################.....####################.....####################.....####################...
...####################.....####################.....####################.....####################.....####################..
....####################.....####################.....####################.....####################.....####################.
.....####################.....####################.....####################.....####################.....####################
#.....##############.#####.....##############.#####.....##############.#####.....##############.#####.....##############.####
##.....#############..#####.....#############..#####.....#############..#####.....#############..#####.....#############..###
###....#############...#####....#############...#####....#############...#####....#############...#####....#############...##
####...#############....#####...#############....#####...#############....#####...#############....#####...#############....#
#####..#############.....#####..#############.....#####..#############.....#####..#############.....#####..#############.....
.#####.#############......#####.#############......#####.#############......#####.#############......#####.#############.....
..##################.......##################.......##################.......##################.......##################.....
........#####....................#####....................#####....................#####....................#####............
.........#####....................#####....................#####....................#####....................#####...........
..........#####....................#####....................#####....................#####....................#####..........
...........#####....................#####....................#####....................#####....................#####.........
............#####....................#####....................#####....................#####....................#####........
  • Argumen lebar harus didahulukan. Format input yang masuk akal (mis w,h. w h, (w, h)) Baik-baik saja.
  • Cetak atau kembalikan hasilnya dengan baris tambahan opsional.
  • Anda dapat menggunakan dua karakter ASCII yang dapat dicetak untuk menggantikan .dan #.
  • Anda dapat menerjemahkan sel pangkalan secara vertikal atau horizontal, seolah-olah memiliki kondisi batas periodik . Jadi sudut kiri atas dari output tidak harus persegi panjang 7 × 8 .. ( Aturan baru! )

Kode terpendek dalam byte menang.

Sebagai bonus, hasilkan gambar sebagai gantinya di mana masing .- masing adalah pixel dari satu warna dan masing-masing #adalah pixel dari warna lain.


Bonus seperti apa? Sebuah biskuit..? ;-)
Zach Gates

4
Persetan "kemenangan kode terpendek" Anda, saya gagal!
El'endia Starman

7
@ZachGates Mungkin biskuit anjing.
Calvin Hobbies

Gulung Tide untuk itu!
Greg Bacon

Jawaban:


17

Pyth, 61 60 55 49 byte

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

Cobalah online: Demonstrasi

sunting 1: Gabungkan dua pernyataan yang menghasilkan pita dan segitiga (lihat di bawah)

sunting 2: Tidak melihat bahwa kami dapat menggunakan simbol apa pun. Disimpan 5 byte edit

sunting 3: @Hobi Calvin diizinkan menerjemahkan gambar dasar. Karena pendekatan saya didasarkan pada ide ini, ini banyak membantu. -6 byte

Dan untuk bonus Cookie :

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

Ini hanya 2 byte lebih lama (51 byte) dan menghasilkan file o.png. Untuk input 5\n4itu menghasilkan gambar berikut:

Pola Houndstooth

Penjelasan:

Pola Houndstooth terlihat sangat tidak teratur. Tetapi jika kita membawa 7 kolom kiri ke kanan dan 5 baris teratas ke botton kita mendapatkan pola yang lebih bagus:

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

Pertama saya membuat blok 13x13 kiri atas:

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

Ada 2 ketidaksetaraan sederhana, yang menggambarkan dua- #daerah. Band dapat dijelaskan oleh y + 1 <= x <= y + 5dan segitiga dapat dijelaskan oleh x <= y - 5. Saya sudah menggabungkan dua kondisi ini:

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

Kemudian +Rm012tambahkan 12 nol di akhir setiap baris, untuk mendapatkan blok 25x13 atas.

Blok 25x13 bawah sekarang sangat sederhana:

+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. 

Yang tersisa sekarang adalah mengulangi pola dan mencetaknya

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

Perbedaan dengan kode bonus Cookie :

  • 255 dari pada 1
  • bukannya mjk*Qdsaya gunakan *RQ, karena saya tidak ingin string
  • .w menyimpan 2D-array ini ke file (mengubahnya ke png secara implisit)

5
Penjelasan yang luar biasa!
trichoplax

Anda jelas berarti "5 baris terbawah ke atas", itu hanya salah ketik. Saya tidak mengerti mengapa komentar saya dihapus tanpa tindakan apa pun. Akibatnya saya malu untuk pergi dan mengedit posting Anda sendiri sekarang. Semua dalam semua, jawaban yang sangat bagus dan penjelasan yang sangat baik. Saya sudah memutarnya sebelumnya
Level River St

@steveverrill Oh, maaf. Saya pikir Anda ingin memperbaiki bahasa Inggris saya di bagian ini, di mana saya menggambarkan transformasi kembali. Perbaiki sekarang. Terima kasih.
Jakube

11

CJam, 106 73 71 byte

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*

Mencetak 1dan 0bukannya .dan #. Cobalah online di juru bahasa CJam .

Bagaimana itu bekerja

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.

Bonus kue

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*

mencetak Portable BitMap alih-alih seni ASCII.

Di bawah ini adalah output untuk input 24 13, dikonversi ke PNG:

keluaran


7

Befunge-93 , 2120 1967 bytes

Ini beberapa befunge berkualitas tinggi, dengan penanganan pengecualian untuk debugging!

&&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<

(Jelas, ini masih sangat golf. Saya hanya ingin mendapatkan jawaban di sini untuk saat ini)

Jadi, ini terdiri dari bagian yang berbeda.

&&00p10p

Ini hanya penginisialisasi, mengambil nilai dan menyimpannya

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

Bagian ini mengatur ulang jumlah baris, sehingga kami dapat mencetak gambar (lebar) lainnya berdampingan. 94+2*menghitung 26, jumlah baris. Juga, jika tingginya nol, program akan berakhir.

>10g

Ini mendapatkan lebar pada tumpukan sehingga kita tahu berapa banyak yang harus dicetak

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

Ini menambahkan dua nilai dummy ke stack untuk memberi tahu kapan kita telah menyelesaikan operasi, serta baris (n) apa yang sedang kita gunakan. Ini kemudian menambahkan nilai n ke stack

>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"....@

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

Ini adalah bagian kontrol yang akan ke baris (26-n). Ini adalah cara termudah yang saya tahu bagaimana melakukannya.

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

Ini, jelas, sudah dibaca dan akan memunculkan baris apa pun yang dibaca ke tumpukan ke belakang. Ini berarti ketika kita mematikannya, itu akan dicetak dengan benar.

v_
,:
>^

Ini akan mencetak sampai tumpukan mencapai angka 0, yang kita tinggalkan sebelumnya.

1-:#^_

Ini menghilangkan 1 dari jumlah baris tertentu untuk dicetak, kemudian memeriksa apakah nol atau tidak. Jika bukan nol, kita kembali ke blok kode keempat.

          ,
          +
20g1-20p55^

Ini mengurangi 1 dari baris (n), mencetak baris baru, dan kembali ke blok 3

p00-1g00

Setelah semua baris telah dicetak, ini mengurangi satu dari ketinggian awal dan kembali ke blok 2.

Seluruh kode lainnya adalah kontrol aliran atau manajemen tumpukan. Menulis mas ini lebih dari yang saya kira, tapi saya puas dengan tampilannya. Ini jauh lebih golf, dan itu kemungkinan akan tetap menjadi proyek untuk hari lain.

2120 -> 1967 : memangkas beberapa garis dengan banyak ruang kosong


1
Saya bermain golf. Bukan jawaban Anda secara khusus, tetapi saya menemukan solusi di Befunge!
El'endia Starman

6

Perl, 243

(Satu byte ditambahkan untuk -nswitch untuk mengambil input dari stdin.)

($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)}

Ini cukup mudah - yang dilakukannya hanyalah mengonversi array 26 angka hex ke biner dan mencetaknya beberapa kali.

Contoh:

Memasukkan:

3 2

Keluaran:

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

Rev 1, C, 118 115 byte

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 byte disimpan karena aturan baru yang memungkinkan terjemahan sel. 3 byte disimpan dengan menggunakan w*=25. Sisa pos tetap tidak berubah.

Rev 0, C, 127 byte

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);}

Ini melewati karakter, mencetaknya satu per satu. i%(25*w)||puts("")menyisipkan baris baru di akhir setiap baris.

Cara saya melihat desainnya mirip dengan Jakube, tapi saya membawa 8 baris teratas ke bawah dan 5 kolom kanan ke kiri untuk mendapatkan tampilan berikut. Dalam program ini langkah ini "terbalik" oleh +20dan +8dalam ekspresi untuk x dan y.

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

Terlepas dari "inversi warna" mungkin terlihat sangat mirip, tetapi ada perbedaan penting: garis-garis diagonal cocok. (perhatikan bahwa desain aslinya tidak memiliki simetri diagonal karena ukurannya 25x26.)

Ekspresi ((y>x^y>x+5^x>y+4)^y/13)+34menghasilkan yang berikut, di mana berbagai operator perbandingan menghasilkan garis-garis, yang ^y/13menghasilkan "flip warna" setengah jalan dan +34mengambil jumlah yang dihasilkan 0,1dan mendorongnya ke kisaran ASCII 34,35.

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

Istilah &y/13==x/13mengevaluasi ke false = 0 di perempat kanan atas dan kiri bawah, menghasilkan bagian kuadrat dari pola seperti yang ditunjukkan sebelumnya. Perhatikan bahwa karena program downcounts, asal x = y = 0 ada di kanan bawah. Ini berguna karena kuadrat #adalah 13 karakter sedangkan kuadrat "hanya 12 karakter.


2

Befunge -93, 968 byte

Ya itu betul! Jawaban Befunge yang bersaing!

&:&\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

Penjelasan besok, tidur sekarang. Saya akan mengatakan, bagaimanapun, bahwa saya melakukan hal-hal pintar dengan memindahkan beberapa panah redirection dan saya menggunakan properti wrap-around juga sedikit. Uji dalam juru bahasa online ini .

Dengan menggunakan situs kami, Anda mengakui telah membaca dan memahami Kebijakan Cookie dan Kebijakan Privasi kami.
Licensed under cc by-sa 3.0 with attribution required.