Kotak Hitung

8

Kita semua telah melihat gambar-gambar dengan tulisan "Berapa banyak kotak dalam gambar ini? 98% tidak akan mendapatkan ini dengan benar!" Nah, inilah kesempatan Anda untuk menertawakan 98% itu.

Memasukkan

Blok persegi panjang yang hanya terdiri dari 2 karakter. Dalam bentuk umum, ini didefinisikan oleh m baris, masing-masing berisi n karakter.

Contoh:

0000xxx
00x00xx
00000xx
xxxxx0x

Ini dapat direpresentasikan sebagai string yang dipisahkan oleh baris baru, larik string, atau larik karakter 2D. Jenis input lain harus disarankan dalam komentar.

Keluaran

Output akan berupa bilangan bulat yang mewakili jumlah total kuadrat yang diwakili secara individual oleh kedua karakter (dalam pseudocode, num_squares (char1) + num_squares (char2))

Sebuah persegi didefinisikan sebagai satu set contoh dari karakter yang sama yang sepenuhnya menguraikan persegi geometris sisi panjang minimal 2 . Kotak ini tidak perlu diisi oleh karakter yang menguraikannya. Contoh-contoh berikut menggambarkan konsep ini:

x0
0x    // no squares

xxx
x0x
xxx   // 1 square of side length 3

0000
0xx0
0xx0
0000  // 1 square of side length 2, 1 square of side length 4

Mencetak gol

Program Anda akan dinilai oleh 2 kriteria, dengan urutan kepentingan:

  • Jumlah karakter dalam blok kode Anda yang bukan bagian dari kotak, seperti yang didefinisikan di atas (Anda harus berusaha meminimalkan ini!) (Catatan: karakter di dalam kotak tidak secara otomatis dianggap sebagai bagian dari kotak itu) (Catatan 2: baris baru tidak diperhitungkan dalam skor ini)
  • Jumlah byte (Anda harus berusaha meminimalkan ini!)

Kriteria kedua akan bertindak sebagai pemutus dasi untuk yang pertama.

Aturan Tantangan

  • Demi fleksibilitas, Anda dapat memilih untuk menggunakan 2 karakter alfanumerik apa pun untuk mengganti 0 dan x dari contoh saya, selama mereka bukan karakter yang sama.
  • Setiap baris dalam persegi panjang input harus memiliki panjang yang sama, dan tidak boleh mengandung karakter apa pun selain 2 yang ditentukan untuk jawaban Anda terhadap tantangan (selain karakter baris baru, jika berlaku)
  • Kotak trivial (kotak 1x1 dilambangkan dengan satu karakter) tidak dihitung terhadap output. Mereka payah.
  • Program Anda tidak harus menangani input kosong, tetapi harus menangani kasus di mana tidak ada kotak yang mungkin (ketika salah satu dimensi dari persegi panjang input adalah 1)
  • Anda juga dapat memilih untuk menentukan bahwa Anda menangani kotak yang selaras secara diagonal jika Anda menikmati tantangan. Ini akan ditambahkan ke output yang ditentukan dalam spesifikasi tantangan.

Contoh konsep ini:

Input:

00x00
0x0x0
x000x
0x0x0
00x00

Output: 6 (1 diagonally aligned square of side length 3, 5 diagonally aligned squares of side length 2)

Uji Kasus

Berikut ini adalah beberapa kasus uji dasar yang harus cocok dengan program Anda. Nilai dalam tanda kurung adalah output yang harus Anda pilih untuk menghitung kuadrat selaras diagonal.

Input:

xxxx
x00x
x0xx
xxxx

Output: 2 (2)

Input:

x00000xxx0

Output: 0 (0)

Input:

xxx0x0x000xx0xx0
0x000x00x0x0xx00
00xx0xx00xx0000x
x0x0x0x0x00x0xxx
00xx0xxx00xxx0x0

Output: 0 (5)

Input:

0000
0000
0000
0000
0000
0000

Output: 26 (34)

Input:

xxx00
xx000

Output: 2 (2)

Aturan umum

  • Aturan standar berlaku untuk jawaban Anda, jadi Anda diperbolehkan menggunakan STDIN / STDOUT, fungsi / metode dengan parameter yang tepat dan tipe pengembalian, program penuh. Panggilanmu.
  • Celah default tidak diperbolehkan.
  • Jika memungkinkan, silakan tambahkan tautan dengan tes untuk kode Anda.
  • Menambahkan penjelasan untuk jawaban Anda sangat disarankan.
  • Ada pertanyaan / koreksi / saran untuk saya? Komentar dibawah! Ini adalah pertanyaan pertama saya, jadi saya senang belajar sebanyak mungkin darinya.
TCFP
sumber
2
Bagaimana jumlah kotak dalam kode Anda mempengaruhi skor Anda (saya merasa memiliki kotak harus mengurangi skor Anda)? Ini juga harus ditandai sebagai tantangan kode alih - alih kode-golf karena skor tidak hanya panjang.
FryAmTheEggman
Kriteria penilaian sekarang terutama didasarkan pada kuadrat dan ikatan diputus oleh jumlah byte. Terima kasih untuk umpan baliknya!
TCFP
1
NN
1
Kotak diagonal tidak dihitung untuk penilaian. Saya akan mengatakan kode nonrectangular baik-baik saja, kotak tetap didefinisikan sama seperti dalam spesifikasi. Spesifikasi persegi panjang untuk input sebagian besar demi kesederhanaan.
TCFP
1
Harus diakui, saya tidak memiliki pengetahuan bahasa esoteris seperti itu. Diperlukan untuk memiliki baris baru untuk bahkan menghitung sesuatu sebagai bujur sangkar untuk memulai, jadi saya tidak berpikir itu harus diperhitungkan terhadap skor siapa pun.
TCFP

Jawaban:

5

Perl, 0 karakter tidak dalam kotak (25430 byte)

##((((((((((((((((((((((((((((((((((((((((((((((
##($$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$(
##($rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$(
##($r,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,r$(
##($r,$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,r$(
##($r,$cccccccccccccccccccccccccccccccccccc$,r$(
##($r,$c,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,c$,r$(
##($r,$c,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,c$,r$(
##($r,$c,@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@,c$,r$(
##($r,$c,@a))))))))))))))))))))))))))))a@,c$,r$(
##($r,$c,@a)==========================)a@,c$,r$(
##($r,$c,@a)=@@@@@@@@@@@@@@@@@@@@@@@@=)a@,c$,r$(
##($r,$c,@a)=@AAAAAAAAAAAAAAAAAAAAAA@=)a@,c$,r$(
##($r,$c,@a)=@ARRRRRRRRRRRRRRRRRRRRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGGGGGGGGGGGGGGGGGGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGVVVVVVVVVVVVVVVVGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGV;;;;;;;;;;;;;;VGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGV;<<<<<<<<<<<<;VGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGV;<<<<<<<<<<<<;VGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGV;<<''''''''<<;VGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGV;<<''''''''<<;VGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGV;<<'';;;;''<<;VGRA@=)a@,c$,r$(
  ($r,$c,@a)=@ARGV;<<'';##;''<<;VGRA@=)a@,c$,r$(
  ($r,$c,@a)=@ARGV;<<'';##;''<<;VGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGV;<<'';;;;''<<;VGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGV;<<''''''''<<;VGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGV;<<''''''''<<;VGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGV;<<<<<<<<<<<<;VGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGV;<<<<<<<<<<<<;VGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGV;;;;;;;;;;;;;;VGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGVVVVVVVVVVVVVVVVGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARGGGGGGGGGGGGGGGGGGRA@=)a@,c$,r$(
##($r,$c,@a)=@ARRRRRRRRRRRRRRRRRRRRA@=)a@,c$,r$(
##($r,$c,@a)=@AAAAAAAAAAAAAAAAAAAAAA@=)a@,c$,r$(
##($r,$c,@a)=@@@@@@@@@@@@@@@@@@@@@@@@=)a@,c$,r$(
##($r,$c,@a)==========================)a@,c$,r$(
##($r,$c,@a))))))))))))))))))))))))))))a@,c$,r$(
##($r,$c,@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@,c$,r$(
##($r,$c,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,c$,r$(
##($r,$c,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,c$,r$(
##($r,$cccccccccccccccccccccccccccccccccccc$,r$(
##($r,$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,r$(
##($r,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,r$(
##($rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$(
##($$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$(
##((((((((((((((((((((((((((((((((((((((((((((((

##ffffffffffffffffffffffffffffffffffffffffff
##foooooooooooooooooooooooooooooooooooooooof
##forrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrof
##for$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$rof
##for$yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy$rof
##for$y((((((((((((((((((((((((((((((((y$rof
##for$y(000000000000000000000000000000(y$rof
##for$y(0............................0(y$rof
##for$y(0............................0(y$rof
##for$y(0..$$$$$$$$$$$$$$$$$$$$$$$$..0(y$rof
##for$y(0..$rrrrrrrrrrrrrrrrrrrrrr$..0(y$rof
##for$y(0..$r--------------------r$..0(y$rof
##for$y(0..$r-111111111111111111-r$..0(y$rof
##for$y(0..$r-1))))))))))))))))1-r$..0(y$rof
##for$y(0..$r-1){{{{{{{{{{{{{{)1-r$..0(y$rof
##for$y(0..$r-1){<<<<<<<<<<<<{)1-r$..0(y$rof
##for$y(0..$r-1){<<<<<<<<<<<<{)1-r$..0(y$rof
##for$y(0..$r-1){<<''''''''<<{)1-r$..0(y$rof
##for$y(0..$r-1){<<''''''''<<{)1-r$..0(y$rof
##for$y(0..$r-1){<<'';;;;''<<{)1-r$..0(y$rof
  for$y(0..$r-1){<<'';##;''<<{)1-r$..0(y$rof
  for$y(0..$r-1){<<'';##;''<<{)1-r$..0(y$rof
##for$y(0..$r-1){<<'';;;;''<<{)1-r$..0(y$rof
##for$y(0..$r-1){<<''''''''<<{)1-r$..0(y$rof
##for$y(0..$r-1){<<''''''''<<{)1-r$..0(y$rof
##for$y(0..$r-1){<<<<<<<<<<<<{)1-r$..0(y$rof
##for$y(0..$r-1){<<<<<<<<<<<<{)1-r$..0(y$rof
##for$y(0..$r-1){{{{{{{{{{{{{{)1-r$..0(y$rof
##for$y(0..$r-1))))))))))))))))1-r$..0(y$rof
##for$y(0..$r-111111111111111111-r$..0(y$rof
##for$y(0..$r--------------------r$..0(y$rof
##for$y(0..$rrrrrrrrrrrrrrrrrrrrrr$..0(y$rof
##for$y(0..$$$$$$$$$$$$$$$$$$$$$$$$..0(y$rof
##for$y(0............................0(y$rof
##for$y(0............................0(y$rof
##for$y(000000000000000000000000000000(y$rof
##for$y((((((((((((((((((((((((((((((((y$rof
##for$yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy$rof
##for$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$rof
##forrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrof
##foooooooooooooooooooooooooooooooooooooooof
##ffffffffffffffffffffffffffffffffffffffffff

##ffffffffffffffffffffffffffffffffffffffffff
##foooooooooooooooooooooooooooooooooooooooof
##forrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrof
##for$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$rof
##for$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx$rof
##for$x((((((((((((((((((((((((((((((((x$rof
##for$x(000000000000000000000000000000(x$rof
##for$x(0............................0(x$rof
##for$x(0............................0(x$rof
##for$x(0..$$$$$$$$$$$$$$$$$$$$$$$$..0(x$rof
##for$x(0..$cccccccccccccccccccccc$..0(x$rof
##for$x(0..$c--------------------c$..0(x$rof
##for$x(0..$c-111111111111111111-c$..0(x$rof
##for$x(0..$c-1))))))))))))))))1-c$..0(x$rof
##for$x(0..$c-1){{{{{{{{{{{{{{)1-c$..0(x$rof
##for$x(0..$c-1){<<<<<<<<<<<<{)1-c$..0(x$rof
##for$x(0..$c-1){<<<<<<<<<<<<{)1-c$..0(x$rof
##for$x(0..$c-1){<<''''''''<<{)1-c$..0(x$rof
##for$x(0..$c-1){<<''''''''<<{)1-c$..0(x$rof
##for$x(0..$c-1){<<'';;;;''<<{)1-c$..0(x$rof
  for$x(0..$c-1){<<'';##;''<<{)1-c$..0(x$rof
  for$x(0..$c-1){<<'';##;''<<{)1-c$..0(x$rof
##for$x(0..$c-1){<<'';;;;''<<{)1-c$..0(x$rof
##for$x(0..$c-1){<<''''''''<<{)1-c$..0(x$rof
##for$x(0..$c-1){<<''''''''<<{)1-c$..0(x$rof
##for$x(0..$c-1){<<<<<<<<<<<<{)1-c$..0(x$rof
##for$x(0..$c-1){<<<<<<<<<<<<{)1-c$..0(x$rof
##for$x(0..$c-1){{{{{{{{{{{{{{)1-c$..0(x$rof
##for$x(0..$c-1))))))))))))))))1-c$..0(x$rof
##for$x(0..$c-111111111111111111-c$..0(x$rof
##for$x(0..$c--------------------c$..0(x$rof
##for$x(0..$cccccccccccccccccccccc$..0(x$rof
##for$x(0..$$$$$$$$$$$$$$$$$$$$$$$$..0(x$rof
##for$x(0............................0(x$rof
##for$x(0............................0(x$rof
##for$x(000000000000000000000000000000(x$rof
##for$x((((((((((((((((((((((((((((((((x$rof
##for$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx$rof
##for$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$rof
##forrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrof
##foooooooooooooooooooooooooooooooooooooooof
##ffffffffffffffffffffffffffffffffffffffffff

##ffffffffffffffffffffffffffffffffffffffffffffffff
##foooooooooooooooooooooooooooooooooooooooooooooof
##forrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrof
##for$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$rof
##for$ssssssssssssssssssssssssssssssssssssssss$rof
##for$s((((((((((((((((((((((((((((((((((((((s$rof
##for$s(111111111111111111111111111111111111(s$rof
##for$s(1..................................1(s$rof
##for$s(1..................................1(s$rof
##for$s(1..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$..1(s$rof
##for$s(1..$cccccccccccccccccccccccccccc$..1(s$rof
##for$s(1..$c--------------------------c$..1(s$rof
##for$s(1..$c-$$$$$$$$$$$$$$$$$$$$$$$$-c$..1(s$rof
##for$s(1..$c-$xxxxxxxxxxxxxxxxxxxxxx$-c$..1(s$rof
##for$s(1..$c-$x--------------------x$-c$..1(s$rof
##for$s(1..$c-$x-111111111111111111-x$-c$..1(s$rof
##for$s(1..$c-$x-1))))))))))))))))1-x$-c$..1(s$rof
##for$s(1..$c-$x-1){{{{{{{{{{{{{{)1-x$-c$..1(s$rof
##for$s(1..$c-$x-1){<<<<<<<<<<<<{)1-x$-c$..1(s$rof
##for$s(1..$c-$x-1){<<<<<<<<<<<<{)1-x$-c$..1(s$rof
##for$s(1..$c-$x-1){<<''''''''<<{)1-x$-c$..1(s$rof
##for$s(1..$c-$x-1){<<''''''''<<{)1-x$-c$..1(s$rof
##for$s(1..$c-$x-1){<<'';;;;''<<{)1-x$-c$..1(s$rof
  for$s(1..$c-$x-1){<<'';##;''<<{)1-x$-c$..1(s$rof
  for$s(1..$c-$x-1){<<'';##;''<<{)1-x$-c$..1(s$rof
##for$s(1..$c-$x-1){<<'';;;;''<<{)1-x$-c$..1(s$rof
##for$s(1..$c-$x-1){<<''''''''<<{)1-x$-c$..1(s$rof
##for$s(1..$c-$x-1){<<''''''''<<{)1-x$-c$..1(s$rof
##for$s(1..$c-$x-1){<<<<<<<<<<<<{)1-x$-c$..1(s$rof
##for$s(1..$c-$x-1){<<<<<<<<<<<<{)1-x$-c$..1(s$rof
##for$s(1..$c-$x-1){{{{{{{{{{{{{{)1-x$-c$..1(s$rof
##for$s(1..$c-$x-1))))))))))))))))1-x$-c$..1(s$rof
##for$s(1..$c-$x-111111111111111111-x$-c$..1(s$rof
##for$s(1..$c-$x--------------------x$-c$..1(s$rof
##for$s(1..$c-$xxxxxxxxxxxxxxxxxxxxxx$-c$..1(s$rof
##for$s(1..$c-$$$$$$$$$$$$$$$$$$$$$$$$-c$..1(s$rof
##for$s(1..$c--------------------------c$..1(s$rof
##for$s(1..$cccccccccccccccccccccccccccc$..1(s$rof
##for$s(1..$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$..1(s$rof
##for$s(1..................................1(s$rof
##for$s(1..................................1(s$rof
##for$s(111111111111111111111111111111111111(s$rof
##for$s((((((((((((((((((((((((((((((((((((((s$rof
##for$ssssssssssssssssssssssssssssssssssssssss$rof
##for$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$rof
##forrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrof
##foooooooooooooooooooooooooooooooooooooooooooooof
##ffffffffffffffffffffffffffffffffffffffffffffffff

##$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
##$mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm$
##$m========================================================m$
##$m=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=m$
##$m=$aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$=m$
##$m=$a[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[a$=m$
##$m=$a[$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$[a$=m$
##$m=$a[$oooooooooooooooooooooooooooooooooooooooooooooo$[a$=m$
##$m=$a[$o============================================o$[a$=m$
##$m=$a[$o=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=o$[a$=m$
##$m=$a[$o=$cccccccccccccccccccccccccccccccccccccccc$=o$[a$=m$
##$m=$a[$o=$c**************************************c$=o$[a$=m$
##$m=$a[$o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$$$$$$$$$$$$$$$$$$$$$$$$$$$$*c$=o$[a$=m$
##$m=$a[$o=$c**************************************c$=o$[a$=m$
##$m=$a[$o=$cccccccccccccccccccccccccccccccccccccccc$=o$[a$=m$
##$m=$a[$o=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=o$[a$=m$
##$m=$a[$o============================================o$[a$=m$
##$m=$a[$oooooooooooooooooooooooooooooooooooooooooooooo$[a$=m$
##$m=$a[$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$[a$=m$
##$m=$a[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[a$=m$
##$m=$aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$=m$
##$m=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=m$
##$m========================================================m$
##$mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm$
##$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

##ffffffffffffffffffffffffffffffffffffff
##foooooooooooooooooooooooooooooooooooof
##forrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrof
##for$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$rof
##for$tttttttttttttttttttttttttttttt$rof
##for$t((((((((((((((((((((((((((((t$rof
##for$t(11111111111111111111111111(t$rof
##for$t(1........................1(t$rof
##for$t(1........................1(t$rof
##for$t(1..$$$$$$$$$$$$$$$$$$$$..1(t$rof
##for$t(1..$ssssssssssssssssss$..1(t$rof
##for$t(1..$s))))))))))))))))s$..1(t$rof
##for$t(1..$s){{{{{{{{{{{{{{)s$..1(t$rof
##for$t(1..$s){<<<<<<<<<<<<{)s$..1(t$rof
##for$t(1..$s){<<<<<<<<<<<<{)s$..1(t$rof
##for$t(1..$s){<<''''''''<<{)s$..1(t$rof
##for$t(1..$s){<<''''''''<<{)s$..1(t$rof
##for$t(1..$s){<<'';;;;''<<{)s$..1(t$rof
  for$t(1..$s){<<'';##;''<<{)s$..1(t$rof
  for$t(1..$s){<<'';##;''<<{)s$..1(t$rof
##for$t(1..$s){<<'';;;;''<<{)s$..1(t$rof
##for$t(1..$s){<<''''''''<<{)s$..1(t$rof
##for$t(1..$s){<<''''''''<<{)s$..1(t$rof
##for$t(1..$s){<<<<<<<<<<<<{)s$..1(t$rof
##for$t(1..$s){<<<<<<<<<<<<{)s$..1(t$rof
##for$t(1..$s){{{{{{{{{{{{{{)s$..1(t$rof
##for$t(1..$s))))))))))))))))s$..1(t$rof
##for$t(1..$ssssssssssssssssss$..1(t$rof
##for$t(1..$$$$$$$$$$$$$$$$$$$$..1(t$rof
##for$t(1........................1(t$rof
##for$t(1........................1(t$rof
##for$t(11111111111111111111111111(t$rof
##for$t((((((((((((((((((((((((((((t$rof
##for$tttttttttttttttttttttttttttttt$rof
##for$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$rof
##forrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrof
##foooooooooooooooooooooooooooooooooooof
##ffffffffffffffffffffffffffffffffffffff

##ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
##foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooof
##forrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrof
##for((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((rof
##for($$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$(rof
##for($tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt$(rof
##for($t,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,t$(rof
##for($t,$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,t$(rof
##for($t,$cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc$,t$(rof
##for($t,$c**********************************************************c$,t$(rof
##for($t,$c*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*c$,t$(rof
##for($t,$c*$tttttttttttttttttttttttttttttttttttttttttttttttttttttt$*c$,t$(rof
##for($t,$c*$t,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,t$*c$,t$(rof
##for($t,$c*$t,$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,t$*c$,t$(rof
##for($t,$c*$t,$tttttttttttttttttttttttttttttttttttttttttttttttt$,t$*c$,t$(rof
##for($t,$c*$t,$t++++++++++++++++++++++++++++++++++++++++++++++t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$cccccccccccccccccccccccccccccccccccccccccc$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c****************************************c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$ssssssssssssssssssssssssssssssssssss$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$cccccccccccccccccccccccccccccc$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c****************************c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$$$$$$$$$$$$$$$$$$$$$$$$$$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$tttttttttttttttttttttttt$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t++++++++++++++++++++++t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$$$$$$$$$$$$$$$$$$$$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$ssssssssssssssssss$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s))))))))))))))))s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s){{{{{{{{{{{{{{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s){<<<<<<<<<<<<{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s){<<<<<<<<<<<<{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s){<<''''''''<<{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s){<<''''''''<<{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s){<<'';;;;''<<{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
  for($t,$c*$t,$t+$c*$s,$c*$t+$s){<<'';##;''<<{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
  for($t,$c*$t,$t+$c*$s,$c*$t+$s){<<'';##;''<<{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s){<<'';;;;''<<{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s){<<''''''''<<{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s){<<''''''''<<{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s){<<<<<<<<<<<<{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s){<<<<<<<<<<<<{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s){{{{{{{{{{{{{{)s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$s))))))))))))))))s$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$ssssssssssssssssss$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t+$$$$$$$$$$$$$$$$$$$$+t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$t++++++++++++++++++++++t$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$tttttttttttttttttttttttt$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c*$$$$$$$$$$$$$$$$$$$$$$$$$$*c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$c****************************c$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$cccccccccccccccccccccccccccccc$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$s,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,s$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$ssssssssssssssssssssssssssssssssssss$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$c****************************************c$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$cccccccccccccccccccccccccccccccccccccccccc$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+t$,t$*c$,t$(rof
##for($t,$c*$t,$t++++++++++++++++++++++++++++++++++++++++++++++t$,t$*c$,t$(rof
##for($t,$c*$t,$tttttttttttttttttttttttttttttttttttttttttttttttt$,t$*c$,t$(rof
##for($t,$c*$t,$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,t$*c$,t$(rof
##for($t,$c*$t,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,t$*c$,t$(rof
##for($t,$c*$tttttttttttttttttttttttttttttttttttttttttttttttttttttt$*c$,t$(rof
##for($t,$c*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*c$,t$(rof
##for($t,$c**********************************************************c$,t$(rof
##for($t,$cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc$,t$(rof
##for($t,$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,t$(rof
##for($t,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,t$(rof
##for($tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt$(rof
##for($$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$(rof
##for((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((rof
##forrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrof
##foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooof
##ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

##$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
##$kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk$
##$k++++++++++++++++++++++++++++++++++++++++++++k$
##$k+==========================================+k$
##$k+=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=+k$
##$k+=$aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$=+k$
##$k+=$a[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[a$=+k$
##$k+=$a[$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$[a$=+k$
##$k+=$a[$oooooooooooooooooooooooooooooooo$[a$=+k$
##$k+=$a[$o++++++++++++++++++++++++++++++o$[a$=+k$
##$k+=$a[$o+$$$$$$$$$$$$$$$$$$$$$$$$$$$$+o$[a$=+k$
##$k+=$a[$o+$__________________________$+o$[a$=+k$
##$k+=$a[$o+$_]]]]]]]]]]]]]]]]]]]]]]]]_$+o$[a$=+k$
##$k+=$a[$o+$_]eeeeeeeeeeeeeeeeeeeeee]_$+o$[a$=+k$
##$k+=$a[$o+$_]eqqqqqqqqqqqqqqqqqqqqe]_$+o$[a$=+k$
##$k+=$a[$o+$_]eq$$$$$$$$$$$$$$$$$$qe]_$+o$[a$=+k$
##$k+=$a[$o+$_]eq$mmmmmmmmmmmmmmmm$qe]_$+o$[a$=+k$
##$k+=$a[$o+$_]eq$m;;;;;;;;;;;;;;m$qe]_$+o$[a$=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
##$k+=$a[$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$[a$=+k$
##$k+=$a[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[a$=+k$
##$k+=$aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$=+k$
##$k+=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=+k$
##$k+==========================================+k$
##$k++++++++++++++++++++++++++++++++++++++++++++k$
##$kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk$
##$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

##}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
##}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
##}}$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$}}
##}}$nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn$}}
##}}$n++++++++++++++++++++++++++++++++++n$}}
##}}$n+================================+n$}}
##}}$n+=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=+n$}}
##}}$n+=$kkkkkkkkkkkkkkkkkkkkkkkkkkkk$=+n$}}
##}}$n+=$k==========================k$=+n$}}
##}}$n+=$k==========================k$=+n$}}
##}}$n+=$k==4444444444444444444444==k$=+n$}}
##}}$n+=$k==4********************4==k$=+n$}}
##}}$n+=$k==4*$$$$$$$$$$$$$$$$$$*4==k$=+n$}}
##}}$n+=$k==4*$ssssssssssssssss$*4==k$=+n$}}
##}}$n+=$k==4*$s;;;;;;;;;;;;;;s$*4==k$=+n$}}
##}}$n+=$k==4*$s;<<<<<<<<<<<<;s$*4==k$=+n$}}
##}}$n+=$k==4*$s;<<<<<<<<<<<<;s$*4==k$=+n$}}
##}}$n+=$k==4*$s;<<''''''''<<;s$*4==k$=+n$}}
##}}$n+=$k==4*$s;<<''''''''<<;s$*4==k$=+n$}}
##}}$n+=$k==4*$s;<<'';;;;''<<;s$*4==k$=+n$}}
  }}$n+=$k==4*$s;<<'';##;''<<;s$*4==k$=+n$}}
  }}$n+=$k==4*$s;<<'';##;''<<;s$*4==k$=+n$}}
##}}$n+=$k==4*$s;<<'';;;;''<<;s$*4==k$=+n$}}
##}}$n+=$k==4*$s;<<''''''''<<;s$*4==k$=+n$}}
##}}$n+=$k==4*$s;<<''''''''<<;s$*4==k$=+n$}}
##}}$n+=$k==4*$s;<<<<<<<<<<<<;s$*4==k$=+n$}}
##}}$n+=$k==4*$s;<<<<<<<<<<<<;s$*4==k$=+n$}}
##}}$n+=$k==4*$s;;;;;;;;;;;;;;s$*4==k$=+n$}}
##}}$n+=$k==4*$ssssssssssssssss$*4==k$=+n$}}
##}}$n+=$k==4*$$$$$$$$$$$$$$$$$$*4==k$=+n$}}
##}}$n+=$k==4********************4==k$=+n$}}
##}}$n+=$k==4444444444444444444444==k$=+n$}}
##}}$n+=$k==========================k$=+n$}}
##}}$n+=$k==========================k$=+n$}}
##}}$n+=$kkkkkkkkkkkkkkkkkkkkkkkkkkkk$=+n$}}
##}}$n+=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=+n$}}
##}}$n+================================+n$}}
##}}$n++++++++++++++++++++++++++++++++++n$}}
##}}$nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn$}}
##}}$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$}}
##}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
##}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

##}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
##}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
##}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
##}}}pppppppppppppppppppppppppppp}}}
##}}}prrrrrrrrrrrrrrrrrrrrrrrrrrp}}}
##}}}priiiiiiiiiiiiiiiiiiiiiiiirp}}}
##}}}prinnnnnnnnnnnnnnnnnnnnnnirp}}}
##}}}printtttttttttttttttttttnirp}}}
##}}}print$$$$$$$$$$$$$$$$$$tnirp}}}
##}}}print$nnnnnnnnnnnnnnnn$tnirp}}}
##}}}print$n;;;;;;;;;;;;;;n$tnirp}}}
##}}}print$n;<<<<<<<<<<<<;n$tnirp}}}
##}}}print$n;<<<<<<<<<<<<;n$tnirp}}}
##}}}print$n;<<''''''''<<;n$tnirp}}}
##}}}print$n;<<''''''''<<;n$tnirp}}}
##}}}print$n;<<'';;;;''<<;n$tnirp}}}
  }}}print$n;<<'';##;''<<;n$tnirp}}}
  }}}print$n;<<'';##;''<<;n$tnirp}}}
##}}}print$n;<<'';;;;''<<;n$tnirp}}}
##}}}print$n;<<''''''''<<;n$tnirp}}}
##}}}print$n;<<''''''''<<;n$tnirp}}}
##}}}print$n;<<<<<<<<<<<<;n$tnirp}}}
##}}}print$n;<<<<<<<<<<<<;n$tnirp}}}
##}}}print$n;;;;;;;;;;;;;;n$tnirp}}}
##}}}print$nnnnnnnnnnnnnnnn$tnirp}}}
##}}}print$$$$$$$$$$$$$$$$$$tnirp}}}
##}}}printtttttttttttttttttttnirp}}}
##}}}prinnnnnnnnnnnnnnnnnnnnnnirp}}}
##}}}priiiiiiiiiiiiiiiiiiiiiiiirp}}}
##}}}prrrrrrrrrrrrrrrrrrrrrrrrrrp}}}
##}}}pppppppppppppppppppppppppppp}}}
##}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
##}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
##}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

Seperti yang Anda lihat, setiap karakter adalah bagian dari kotak. Setengah bagian atas dari setiap kotak besar dikomentari oleh komentar garis, dan bagian bawah (termasuk baris kedua yang tidak dikomentari) diloloskan oleh dokumen besar di sini yang dimulai di tengah-tengah kotak ( <<'';#) dan berakhir di baris kosong setelah alun-alun besar.

Program ini dihasilkan secara otomatis dari program berikut:

($r,$c,@a)=@ARGV;
for$y(0..$r-1){
for$x(0..$c-1){
for$s(1..$c-$x-1){
$m=$a[$o=$c*$y+$x];$k=0;
for$t(1..$s){
for($t,$c*$t,$t+$c*$s,$c*$t+$s){
$k+=$a[$o+$_]eq$m;
}}$n+=$k==4*$s;
}}}print$n;

Yang merupakan program untuk memecahkan tantangan yang sama, tetapi (sangat ringan) golf untuk byte dan panjang garis pendek, bukan untuk skor.

Pertama-tama dibutuhkan input tinggi dan panjang persegi panjang, kemudian karakter individu dari persegi panjang dipisahkan oleh spasi. Contoh penggunaan: Untuk memecahkan persegi panjang

xxxyy
xxyyy
xyyxx

Anda memanggil program seperti ini: perl theprogram.pl 3 5 x x x y y x x y y y x y y x x

Bagaimanapun, dengan mengkuadratkan kode seperti ini, harus mungkin untuk mendapatkan skor 0 atau 2 dengan bahasa pemrograman apa pun yang memiliki solusi satu baris dan karakter komentar garis, dengan mengubah one-liner

one-liner

seperti ini:

##ooooooooooooooooooooo
##onnnnnnnnnnnnnnnnnnno
##oneeeeeeeeeeeeeeeeeno
##one---------------eno
##one-lllllllllllll-eno
##one-liiiiiiiiiiil-eno
##one-linnnnnnnnnil-eno
##one-lineeeeeeenil-eno
##one-linerrrrrenil-eno
##one-liner###renil-eno
  one-liner###renil-eno
##one-liner###renil-eno
##one-linerrrrrenil-eno
##one-lineeeeeeenil-eno
##one-linnnnnnnnnil-eno
##one-liiiiiiiiiiil-eno
##one-lllllllllllll-eno
##one---------------eno
##oneeeeeeeeeeeeeeeeeno
##onnnnnnnnnnnnnnnnnnno
##ooooooooooooooooooooo

Satu-satunya karakter yang bukan bagian dari kotak adalah dua spasi. Bergantung pada bahasanya, mungkin juga ada cara untuk menggunakan string multiline yang pintar atau komentar (seperti Perl di sini-docs) atau semacam kode redundan untuk membuat dua karakter spasi menjadi bujur sangkar.

Adapun mendapatkan byte rendah, solusi saya memiliki banyak perbaikan langsung, dan saya yakin ada juga banyak cara lain untuk memperbaiki teknik ini, tetapi saya tidak memiliki kesabaran untuk itu; Saya hanya ingin memberikan demonstrasi sehingga kalian bisa menjadi liar dengan itu.

Magma
sumber
Kudos untuk mendapatkan jawaban 0 skor pertama!
TCFP
Selamat datang di PPCG! Jawaban bagus. Sebuah link yang TIO akan menjadi tambahan menyambut.
Jonathan Allan
2

MATL , 18 16 14 10 karakter tidak dalam kuadrat ( 92 103 111 127 byte)

!!!ffqqqqQQQ%OOOOGGGxx44---@@&&lllxxTT  ~~~ ++||7 ss--~~~ssvvss
!!!ffqqqqQQQ"OOOOGGGxx44---@@&&lllxxTTYa~~~Z++||7Mss--~~~ssvvss

Input adalah matriks karakter dengan karakter +dan -. Tidak menghitung kotak diagonal.

Cobalah online!

Atau verifikasi semua contoh dan uji kasus .

Luis Mendo
sumber
Saya menghitung baris baru sebagai karakter out-of-square. Wating untuk klarifikasi OP
Luis Mendo
Mengomentari utas utama, melakukan pengeditan: baris baru tidak dihitung terhadap skor Anda :)
TCFP
2

Jelly ,  20 1917 1908  1905 byte , Skor  20  0





ẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆ
ẆZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZẆ
ẆZṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡZẆ
ẆZṡLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLṡZẆ
ẆZṡLƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊLṡZẆ
ẆZṡLƊ€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ƊLṡZẆ
ẆZṡLƊ€ẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZZZZZZZZZZZZZZZZZZZZZZZZZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZUUUUUUUUUUUUUUUUUUUUUUUZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$$$$$$$$$$$$$$$$$$$$$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬƬƬƬƬƬƬƬƬƬƬƬƬƬƬƬƬƬƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢḢḢḢḢḢḢḢḢḢḢḢḢḢḢḢḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€€€€€€€€€€€€€€€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎẎẎẎẎẎẎẎẎẎẎẎẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEEEEEEEEEEEẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEƲƲƲƲƲƲƲƲƲEẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEƲ€€€€€€€ƲEẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEƲ€SSSSS€ƲEẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEƲ€SqqqS€ƲEẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEƲ€SqqqS€ƲEẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEƲ€SqqqS€ƲEẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEƲ€SSSSS€ƲEẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEƲ€€€€€€€ƲEẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEƲƲƲƲƲƲƲƲƲEẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEEEEEEEEEEEẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎẎẎẎẎẎẎẎẎẎẎẎẎ€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢ€€€€€€€€€€€€€€€ḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬḢḢḢḢḢḢḢḢḢḢḢḢḢḢḢḢḢƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$ƬƬƬƬƬƬƬƬƬƬƬƬƬƬƬƬƬƬƬ$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZU$$$$$$$$$$$$$$$$$$$$$UZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZUUUUUUUUUUUUUUUUUUUUUUUZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇZZZZZZZZZZZZZZZZZZZZZZZZZƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇƇṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖṖẎ€ƊLṡZẆ
ẆZṡLƊ€ẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎẎ€ƊLṡZẆ
ẆZṡLƊ€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ƊLṡZẆ
ẆZṡLƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊƊLṡZẆ
ẆZṡLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLṡZẆ
ẆZṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡṡZẆ
ẆZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZẆ
ẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆẆ
⁽⁽ĿĿ
⁽⁽ĿĿ

Program lengkap mengambil daftar daftar .dan +karakter. (Bekerja untuk karakter apa pun, bahkan lebih dari 2).

Cobalah online!

Setiap upaya untuk mengurangi skor dengan memperkenalkan karakter tampaknya hanya meningkatkan skor lebih banyak. Saya kira cara untuk memenangkan tantangan ini adalah untuk menemukan kanan lenguage !

020

ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEƲ€S

Tapi Jelly tidak memiliki karakter komentar, jadi diperlukan sedikit kreativitas tambahan ...

Program Jelly terdiri dari "Tautan" - kode yang dipisahkan oleh karakter baris baru, karakter pilcrow ( - diartikan sebagai byte yang sama dengan baris baru) atau karakter halaman kode yang valid yang tidak memiliki perilaku yang ditentukan (saat ini qadalah contoh). Yang terakhir sebenarnya dihitung sebagai Tautan masing-masing daripada pemisah murni. Eksekusi program dimulai di paling kanan bawah Tautan, "Tautan Utama" (di sini ⁽⁽ĿĿ).

1Ŀnnth0th-mth(-mmodn)th

⁽⁽ĿĿ⁽⁽Ŀ-27150⁽⁽ĿĿ-27150th60q30thẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEƲ€S33q

ẆZṡLƊ€ẎṖƇZU$ƬḢ€ẎEƲ€S - Link: list of lists of characters, lines
Ẇ                    - contiguous slices (i.e [[line1], [line2], ..., [lineN], [line1, line2], [line2, line3], ..., [lineN-1, lineN], [line1, line2, line3], ...., [lineN-2, lineN-1, lineN], ..., ..., lines])
     €               - for each (slice):
    Ɗ                -   last three links as a monad:
 Z                   -     transpose - i.e. get the columns of the slice
   L                 -     length - i.e. get the number of lines in the slice
  ṡ                  -     overlapping slices of given length - i.e. get slices of columns of same length as lines in the original slice ...filled squares of all sizes (including 1-by-1)
      Ẏ              - tighten - from a list of list of squares of each size to a single list of all squares
        Ƈ            - filter keep if this is truthy:
       Ṗ             -   pop (truthy for all but the 1-by-1 squares)
                  €  - for each (filled square)
                 Ʋ   -   last four links as a monad:
            Ƭ        -     collect up until results are no longer unique:
           $         -       last two links as a monad:
         Z           -         transpose  }
          U          -         upend      } - together a quarter rotation
             Ḣ€      -     head each - i.e. first row of each rotation
               Ẏ     -     tighten - i.e. get the entire perimeter (with repeated corners)
                E    -     all equal? (1 if so, 0 otherwise)
                   S - sum
Jonathan Allan
sumber
Saya tidak berpikir ini sebenarnya memiliki skor 0 karena ini benar-benar hanya proxy untuk baris baru. Program ini benar-benar terlihat seperti ini
dylnan
@dylnan - OP berbicara tentang karakter, bukan byte - tetapi 9 s dapat diganti dengan 9 qs atau (s atau apa pun (seperti yang saya katakan di uraian).
Jonathan Allan
... hmm sepertinya tidak bekerja qseperti yang saya kira akan: /
Jonathan Allan
Mengubah karakter mengubah baris mana yang ⁽⁽ĿĿdievaluasi
dylnan
1
Woah, bagus aku tidak berharap itu terjadi. <s> Apakah itu karena qbyte yang tidak digunakan? Ini berfungsi dengan baik uyang juga tidak digunakan. </s> nevermind
dylnan