| Bytes | Lang | Time | Link |
|---|---|---|---|
| 032 | GolfScript | 241227T013928Z | ErikDaPa |
| 025 | Regenerate | 221101T161328Z | DLosc |
| 043 | QBasic | 210204T033832Z | DLosc |
| 038 | C64 Assembler | 250817T092531Z | OSI8 |
| 014 | Vyxal 3 | 250816T164259Z | Themooni |
| 060 | C64 Basic | 250816T091351Z | OSI8 |
| 463 | Bespoke | 250814T090102Z | Josiah W |
| 403 | JavaScript Node.js | 241226T071642Z | l4m2 |
| 2251 | ☾ | 250309T124852Z | Ganer |
| 020 | Kakoune | 241125T174512Z | JoshM |
| 036 | AWK | 241126T143807Z | xrs |
| 107 | Linux binary | 241226T181802Z | набиячлэ |
| 049 | YASEPL | 241127T223741Z | madeforl |
| 013 | Jelly | 210131T054846Z | Unrelate |
| 023 | Uiua | 240421T163448Z | noodle p |
| 010 | Vyxal S | 210131T020456Z | lyxal |
| 2183 | Buffalo | 210131T154055Z | Dingus |
| 014 | Vyxal 3 S | 241122T153649Z | pacman25 |
| 070 | C# | 241121T182540Z | Ezlandin |
| 023 | Joeasus | 241121T153016Z | Unrelate |
| 046 | JavaScript Node.js | 240808T072241Z | Andrew B |
| 016 | Japt S | 240808T112732Z | Shaggy |
| 033 | sed | 221101T203722Z | Jiří |
| 179 | brainfuck | 210210T012515Z | Dingus |
| 008 | Scratch | 221103T041450Z | joyofori |
| 084 | Pascal | 221102T050328Z | Kai Burg |
| 030 | Knight v2 | 221103T070634Z | Sampersa |
| 060 | C gcc | 221102T121517Z | jdt |
| 018 | MathGolf | 221102T095313Z | Kevin Cr |
| 038 | Julia 1.0 | 221101T205418Z | amelies |
| nan | awk | 221101T151708Z | RARE Kpo |
| 048 | R | 210430T011703Z | qwr |
| 049 | Excel | 210429T184545Z | Axuary |
| 013 | 05AB1E | 210131T035549Z | Makonede |
| 050 | JavaScript V8 | 210202T060330Z | ThatCool |
| 030 | BRASCA | 210323T092703Z | SjoerdPe |
| 068 | VBScript | 210323T090613Z | wasif |
| 055 | BBC BASIC | 210224T141259Z | baffinsq |
| 463 | Deadfish~ | 210224T084254Z | emanresu |
| 069 | Whispers v2 | 210223T215355Z | Michael |
| 084 | StupidStackLanguage | 210213T210240Z | Lebster |
| 052 | AWK | 210212T213214Z | Pedro Ma |
| 062 | C gcc | 210210T191321Z | Antonin |
| 042 | Rattle | 210209T032045Z | d01 |
| 063 | Kotlin | 210210T171302Z | grian |
| nan | x8616 machine code | 210202T190918Z | 640KB |
| 057 | Javascript | 210205T114658Z | kanine |
| 031 | ThumbGolf | 210207T023140Z | EasyasPi |
| 226 | brainfuck | 210205T130240Z | RezNesX |
| 030 | Raku | 210203T025722Z | bb94 |
| 033 | Julia REPL | 210202T085833Z | spacetyp |
| 039 | Ruby | 210202T175104Z | Travis |
| 051 | JavaScript ES6 | 210204T131901Z | Irratix |
| 022 | Pyth | 210202T105332Z | Ian H. |
| 049 | Java JDK | 210201T091254Z | Olivier |
| 034 | TeX | 210204T042144Z | Lok |
| 035 | jq | 210204T035527Z | manatwor |
| 079 | Whispers v2 | 210202T232601Z | Leo |
| 022 | Pyth | 210203T211201Z | Scott |
| 038 | PowerShell | 210203T183935Z | Zaelin G |
| 049 | Java JDK | 210203T153651Z | SansStef |
| 025 | K ngn/k | 210201T082629Z | Galen Iv |
| 131 | C# | 210203T090811Z | Bill T |
| 041 | x8616 machine code | 210201T084318Z | user9915 |
| 4745 | PHP | 210202T215002Z | 640KB |
| 017 | Bubblegum | 210202T191356Z | Digital |
| 030 | Haskell | 210202T133756Z | ceased t |
| 037 | Perl 5 | 210201T184226Z | Zaid |
| 060 | Clojure | 210201T231105Z | wintermu |
| 117 | Python 3 | 210201T223054Z | Nala Nka |
| 039 | R | 210131T233746Z | Dominic |
| 061 | C gcc | 210131T022235Z | gastropn |
| 047 | TSQL | 210201T202311Z | BradC |
| 072 | Python 3 | 210201T165814Z | jam berr |
| 126 | C++11 | 210201T180822Z | Quuxplus |
| 370 | brainfuck | 210201T173243Z | user9940 |
| 020 | LabVIEW | 210201T170808Z | ijustlov |
| 039 | Python 3 | 210201T161413Z | wizzwizz |
| 020 | Ohm v2 | 210201T145606Z | Cinaski |
| 098 | Whispers v2 | 210201T110410Z | lyxal |
| 020 | V vim | 210201T092641Z | tsh |
| 042 | Julia | 210201T084717Z | Max |
| 043 | JavaScript V8 | 210201T072742Z | Nina Lis |
| 028 | Bash | 210131T030004Z | GammaFun |
| 045 | JavaScript Node.js | 210201T034841Z | tsh |
| 036 | Python 2 | 210131T021023Z | Sisyphus |
| 063 | C gcc | 210131T025938Z | anotherO |
| 048 | Wolfram Language Mathematica | 210131T191038Z | att |
| 016 | Stax | 210131T171501Z | Razetime |
| 3936 | PowerShell | 210131T151541Z | wasif |
| 021 | APL+WIN | 210131T114836Z | Graham |
| 057 | Red | 210131T095448Z | Galen Iv |
| 046 | JavaScript ES6 | 210131T093735Z | Arnauld |
| 049 | Batch | 210131T013707Z | Neil |
| 054 | Mathematica | 210131T045554Z | numberma |
| 047 | TIBASIC | 210131T044317Z | TiKevin8 |
| 032 | Perl 5 | 210131T043053Z | Sisyphus |
| 038 | Perl 5 | 210131T034308Z | Xcali |
| 014 | Husk | 210131T032406Z | Leo |
| 016 | Charcoal | 210131T013012Z | Neil |
| 025 | Retina 0.8.2 | 210131T012630Z | Neil |
GolfScript, 36 32 bytes
162 2base{'bB'=['uffalo']+}%' '*
Explanation:
162 2base{'bB'=['uffalo']+}%' '*
162 2base => [1 0 1 0 0 0 1 0]
{ }% => map
'bB'= => 'B' if == 1, else 'b'
['uffalo']+ => add 'uffalo'
' '* => ' '.join()
Regenerate, 27 25 bytes
B(((uffalo) b$3) B$2) b$1
Pretty simple: golf repeated substrings using capture groups.
QBasic, 43 bytes
u$="uffalo buffalo
?"B"u$" B"u$" b"u$" B"u$
Abuses a couple tricks with the autoformatter (besides the standard ? for PRINT shortcut): the missing double quote is added at the end of line 1, and semicolons are inferred in the print statement whenever a literal string is next to a variable. After expansion, the code becomes
u$ = "uffalo buffalo"
PRINT "B"; u$; " B"; u$; " b"; u$; " B"; u$
The semicolon trick, plus the fact that string variables need the $ sigil, meant that approaches using more variables to build the string ended up longer.
C64 Assembler, 38 bytes
00fe e7
00ff 62 ; "B"
0100 55 ; "u"
0101 46 ; "f"
0102 46 ; "f"
0103 41 ; "a"
0104 4c ; "l"
0105 4f ; "o"
0106 a2 ff ldx #$ff
0108 86 22 stx $22
010a e8 inx
010b 86 23 stx $23
010d a2 07 ldx #$07
010f 20 25 ab jsr $ab25
0112 46 fe lsr $fe
0114 f0 0d beq $0123
0116 90 06 bcc $011e
0118 a5 ff lda $ff
011a 49 20 eor #$20
011c 85 ff sta $ff
011e 20 3f ab jsr $ab3f
0121 d0 e3 bne $0106
0123 60 rts
The program ist started with SYS 262.
Vyxal 3, 14 bytes
"↜4”8Y162B#Ṭ!„
"↜4”8Y162B#Ṭ!„
"↜4” # "buffalo"
8Y # repeat 8 times
! # title case
#Ṭ # where truthy...
162B # 162 to binary
„ # join on spaces
💎
Created with the help of Luminespire.
<script type="vyxal3">
"↜4”8Y162B#Ṭ!„
</script>
<script>
args=[]
</script>
<script src="https://themoonisacheese.github.io/snippeterpreter/snippet.js" type="module"/>
Bespoke, 463 bytes
any thing(s)in a language same in name do stun us
city in west New York/bullocks in a cattle or goat-like family/to vex or baffle
all of varied senses"BUFFALO"denotes
the grammar all is correct,strangely,reciting it any unlimited amount;buffalos/bison(a bison=a buffalo)do things
Buffalo buffalo buffalo buffalo
if noun has use(s)as verb,language allows mixing it all
you,I am sure,continue bewildered;it will buffalo you
so clever:it will"buffalo"you!a-ha!wise,I
This uses a similar technique to my solution to Sing Happy Birthday to your favourite programming language, but with base-124 numbers.
- 12184 =
b - 8216 =
B - 66 =
B - 3279823851517 =
uffalo
JavaScript (Node.js), 40 bytes by jdt -3 by Weird Glyphs
_=>[...'BbBbbbBb '].join`uffalo `.trim()
☾, 22 chars (51 bytes)
𝚲⬄⭠‹buffalo ›8ᖘ⁰¹⁶⫰
Note: ☾ uses a custom font, but you can run this code in the Web UI
Kakoune, 24 20 bytes
8oBuffalo<esc><a-j>))<a-,>3)<a-,>`kd
basically we write Buffalo with 8 cursors then remove the selections we want to keep capitalized, then lowercase the rest
<a-,> = alt+comma
8oenter insert mode in 8 new linesBuffalowrite Buffalo with each of the cursors<esc>return to normal mode<a-j>join selected lines))<a-,>3)<a-,>rotate through selections removing those we want to keep capitalized;)rotates main selection and<a-,>removes main selection`lowercase each selectionkdgo up and delete leading newline
AWK, 38 36 bytes
$0="BbBbbbBb"{gsub(/./,"&uffalo ")}1
Different approach from other AWK solutions.
-2 bytes, thank you Shaggy
Linux binary, 107 bytes
This is a "Linux/i386 demand-paged executable (QMAGIC) binary" that only works on Linux pre-2.6 (tested on 1.2.13):
0 cc 00 64 00 ; a_midmag
4 43 00 00 00 ; a_text
8 00 00 00 00 ; a_data
12 b0 04 ; a_bss eax=4 mov al,0x4 number=__NR_write
14 EB 10 ; jmp +16
18 00 00 00 00 ; a_syms
22 0C 10 00 00 ; a_entry
26 00 00 00 00 ; a_trsize
30 00 00 00 00 ; a_drsize
34 31db ; xor ebx, ebx
36 b900200000 ; mov ecx, 0x2000
41 c70120427566 ; mov dword [ecx], 0x66754220; " Buf"
47 c7410466616c6f ; mov dword [ecx + 0x4], 0x6f6c6166; "falo"
54 41 ; inc ecx
55 89cf ; mov edi, ecx
57 31d2 ; xor edx, edx
59 b207 ; mov dl, 0x7
61 cd80 ; int 0x80
63 fec2 ; inc dl
65 49 ; dec ecx
66 803720 ; xor byte [edi], 0x20
69 b004 ; mov al, 0x4
71 cd80 ; int 0x80
73 803720 ; xor byte [edi], 0x20
76 b004 ; mov al, 0x4
78 cd80 ; int 0x80
80 803720 ; xor byte [edi], 0x20
83 b004 ; mov al, 0x4
85 cd80 ; int 0x80
87 b004 ; mov al, 0x4
89 cd80 ; int 0x80
91 b004 ; mov al, 0x4
93 cd80 ; int 0x80
95 803720 ; xor byte [edi], 0x20
98 b004 ; mov al, 0x4
100 cd80 ; int 0x80
102 803720 ; xor byte [edi], 0x20
105 b004 ; mov al, 0x4
107 cd80 ; int 0x80
(base64 zABkAEMAAAAAAAAAsATrEAAAAAAMEAAAAAAAAAAAAAAx27kAIAAAxwEgQnVmx0EEZmFsb0GJzzHSsgfNgP7CSYA3ILAEzYCANyCwBM2AgDcgsATNgLAEzYCwBM2AgDcgsATNgIA3ILAEzYA=)
This is equivalent to
memcpy(0x2000, " Buffalo", 8);
write(0, 0x2001, 7);
*(char *)0x2001 ^= 0x20;
write(0, 0x2000, 8);
*(char *)0x2001 ^= 0x20;
write(0, 0x2000, 8);
*(char *)0x2001 ^= 0x20;
write(0, 0x2000, 8);
write(0, 0x2000, 8);
write(0, 0x2000, 8);
*(char *)0x2001 ^= 0x20;
write(0, 0x2000, 8);
*(char *)0x2001 ^= 0x20;
write(0, 0x2000, 8);
writing Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo, then segfaulting and filling your disk (so disable coredumps):
$ ./x
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffaloSegmentation fault
$ ls -l x
-rwxr-xr-x 1 nab nab 107 Dec 26 18:43 x
$ md5sum x
1a5de49bd215235103508bce1e84c6dc x
$ ./x
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffaloSegmentation fault
$ strace ./x
write(0, "Buffalo", 7Buffalo) = 7
write(0, " buffalo", 8 buffalo) = 8
write(0, " Buffalo", 8 Buffalo) = 8
write(0, " buffalo", 8 buffalo) = 8
write(0, " buffalo", 8 buffalo) = 8
write(0, " buffalo", 8 buffalo) = 8
write(0, " Buffalo", 8 Buffalo) = 8
write(0, " buffalo", 8 buffalo) = 8
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++
The text section is mapped r-x, so we can't stuff " Buffalo" in there, hence copying it to BSS at 0x2000 which is mapped rwx (it may be possible to put it in data, but the memory map is already broken because we're stuffing instructions in BSS). Syscalls preserve all arguments except putting the result in eax, hence the need to put 4 (__NR_write) in after each syscall; ^= 0x20 flips between upper and lower-case. I've documented getting a system to run this in a previous code-golf entry.
YASEPL, 49 bytes
=a!1)"BbBbbbB"`1!b¥a,1~#"uffalo "!+}2,7#"buffalo"
Jelly, 15 13 bytes
“ƤhƤDȷ»Ḳ162ṃK
162ṃ Convert 162 to binary, and 1-index each digit into
“ƤhƤDȷ» "Buffalo buffalo"
Ḳ split on spaces.
K Join on spaces.
I was in fact doing something terribly wrong 3 (almost 4) years ago, but this still comes out two bytes shorter than title-casing dynamically:
Jelly, 17 15 bytes
162B“¦ȯø»Œtṛ¡ⱮK
162B Convert 162 to binary,
Ɱ and for every digit
Œt title-case
“¦ȯø» "buffalo"
ṛ¡ that many times.
K Join on spaces.
Uiua, 25 23 bytes
↘2/$"_ _uffalo"⍥¯⋯372@B
Take the binary digits of 372, making a B lowercase where there are ones. Reduce by inserting a space between and appending "uffalo", then drop the first two characters.
⋯ uses little-endian binary, so instead of using 162, I'd use 186. However because I combined steps of the joining by spaces and appending "uffalo" into one step, the first character ends up without the "uffalo" and just has to be removed. To fix this, I prepended an extra 0 to the binary representation to get 372, and just drop the first two characters of the result.
Vyxal S, 11 10 bytes
⁺=bƛ‛ḋ¤nßǐ
-1 byte thanks to pacman256
Explained (old)
⁺>bƛḃ‛ḋ¤$ßǐ
⁺> # Push 163
b # and convert it to binary
ƛ # for each digit:
ḃ # push whether the digit is "truthy"
‛ḋ¤ # and push the string "buffalo"
$ # swap those two values
ßǐ # and if the digit actually is truth, title case it
Buffalo, 2711 2571 2517 2447 2279 2183 bytes
It takes 304 buffalo to produce 8 buffalo?! Yep, you herd that right.
BuffaloBuffaloBuffaloBuffaloBuffaloBuffalo(buffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalo(buffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalo(buffaloBuffaloBuffaloBuffaloBuffaloBuffalobuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalobuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalobuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalobuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalobuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalobuffaloBuffaloBuffaloBuffaloBuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffalobuffalobuffalo)buffaloBuffalobuffalobuffalobuffaloBuffaloBuffaloBuffalobuffaloBuffalobuffalobuffalobuffaloBuffalobuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffalobuffalobuffalo)Buffalobuffalobuffalobuffalo)buffaloBuffalobuffaloBuffalobuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalo.buffaloBuffalo.buffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalo..buffaloBuffalobuffalobuffalobuffalobuffalo.buffaloBuffalo.buffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalo.buffaloBuffalobuffalobuffalobuffalobuffalobuffalobuffalobuffalobuffalo.BuffalobuffaloBuffalobuffaloBuffalobuffaloBuffaloBuffalo.BuffalobuffaloBuffalobuffalo.buffaloBuffalo..buffaloBuffalobuffalobuffalo.buffaloBuffalo.buffaloBuffalo.buffaloBuffalo.BuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffalo.buffaloBuffalo.buffaloBuffalo..buffaloBuffalo.buffaloBuffalo.buffaloBuffalo.buffaloBuffalo.buffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffaloBuffalo(BuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffaloBuffaloBuffalo.BuffalobuffaloBuffalobuffalo.buffaloBuffalo..buffaloBuffalobuffalobuffalo.buffaloBuffalo.buffaloBuffalo.buffaloBuffalo.buffaloBuffalobuffalobuffalo)BuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffaloBuffalobuffalo.buffaloBuffalo.buffaloBuffalo..buffaloBuffalo.buffaloBuffalo.buffaloBuffalo.buffaloBuffalo.BuffalobuffaloBuffalobuffaloBuffalobuffaloBuffaloBuffalo.BuffalobuffaloBuffalobuffalo.buffaloBuffalo..buffaloBuffalobuffalobuffalo.buffaloBuffalo.buffaloBuffalo.
Try it online! Link is to a Buffalo interpreter written in PHP (the header is copied from GitHub). You can also copy-and-paste the code above into the official online interpreter.
Buffalo is a cell-based language like brainfuck or COW. It has seven instructions:
BuffalobuffaloandbuffaloBuffalomove the pointer to the left and right, respectively,BuffaloBuffaloandbuffalobuffaloincrement and decrement the current cell value, respectively,(and)begin and end loops, and.outputs the ASCII character corresponding to the current cell value.
Aiming to get the ASCII codes of Bufalo into successive cells, we first do a coarse initialisation using three nested loops. A correction is then applied to each cell (outside the loops) as necessary. The selected iteration counts (3 for the outer and middle loops and 4 for the inner loop) are apparently optimal. The ASCII code for the lowercase b does not get its own cell; rather, we generate it on the fly in the a cell.
Once the ASCII codes have been generated, the output is printed character-by-character as Buffalo buffalo Buffalo (buffalo )Buffalo buffalo, where the segment in parentheses represents a loop that runs 3 times.
Joeasus, 29 27 23 bytes
pp![BufflotongueTwister
-2 thanks to emanresu A
-4 thanks to lyxal
Joeasus is a joke programming language "interpreted" by the Llama 3 LLM, prompted with a minimal description of itself under the name "Peq". It's often very bad at this, forgetting that it's supposed to be a programming language at all or refusing to bullshit functionality for various operators, not to mention it's virtually unusable outside Kolmogorov complexity challenges, but the bright side is that it can also hallucinate its way out of typos.
A previous solution I nearly posted was C.BufflobTongueTwisterNoPeriod for 30 bytes. Getting it to "programmatically" strip the trailing period is much harder than making it imagine the constant hardcoded that way, or at least without also surrounding the output with extraneous quotes, and one of the few "ground truths" about the language is the presence of a "library of helpful constants" named CT--which in this case I can apparently just abbreviate to C.
Japt -S, 16 bytes
#¢ìbpu)m+"uffalo
#¢ìbpu)m+"uffalo
#¢ :162
ì :To digit array in base
b : Literal "b"
p : Append
u : Uppercase
) :End base conversion
m :Map
+"uffalo : Concatenate "uffalo"
:Implicit output joined with spaces
sed, 35 33 bytes
-2 bytes thanks to user41805
s/^/BbBbbbBb/
s/./ &uffalo/g
s///
34B solution:
-1 byte thanks to user41805
s/^/B b B b b b B b/
s/\>/uffalo/g
35B solution: (The regex matches empty string at first and then is reused for the second s command)
s/b*/B b B b b b B b/i
s//&uffalo/g
brainfuck, 190 179 bytes
+++[>+++[>++++[>++>+++>+++>+++>+++>+++>+++>+++>+[<]>>>-]>->->+>->->-[<]<-]<-]>>>+++.>->.>+++.>+++.>--.>.>+++.>----.[<]>>[.>]<[<]>.>>[.>]<[<]+++[>>[.>]<[<]>-]>.>>[.>]<[-]<[<]>>[.>]
The ASCII codes are initialised using a similar method to my Buffalo answer, though here both b and the second f get their own cells. Printing the output requires fewer instructions in brainfuck compared with Buffalo because of a key difference in the way that loops are handled: brainfuck uses the currently active cell to decide whether a loop ends, whereas Buffalo refers back to the cell that was originally active when the loop was entered. Consequently, we can print runs of letters in successive cells with a simple [.>] loop in brainfuck, a construction that isn't possible in Buffalo.
Scratch, 8 blocks
I tried to refrain from doing anything too illegal like setting the costume as Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo or setting a variable as that.
Here is the scratchblocks code (102 bytes):
when gf clicked
for each[i v]in(8){set[B v]to(join(B)(join(letter(i)of[BbBbbbBb])[uffalo ])
}::control
Usually when people submit scratch, they submit Tosh (https://tosh.blob.codes/), which is Scratch but text-based or an image of the blocks compiled on scratchblocks (https://scratchblocks.github.io). I would’ve done both, but the for each [i v] in (8) block is old and removed and I can’t figure out how to do it on Tosh.
Pascal, 84 B
This program complies to ISO standard 7185 “Pascal” (level 0 sufficient):
program p(output);const s='uffalo buffalo B';begin write('B',s,s:15,'b',s,s:14)end.
MathGolf, 18 bytes
9G*âx{ûbB§╕«Γ╢ô };
âx{ûbB§╕«Γ╢ô could alternatively be à{ENR**╦\i╛δ for the same byte-count: try it online.
Explanation:
9G* # Push 9*18=162
â # Convert it to a binary list
# (which is unfortunately in reversed order due to a bug)
x # Reverse it to the correct order
{ # Loop over each of these bits as integers:
ûbB # Push string "bB"
§ # (0-based) index the current bit into it
╕«Γ # Push compressed string "uffa"
╢ô # Push compressed string "lo"
# Push a space character " "
}; # After the loop: discard the final space
# (after which the entire stack is joined and output implicitly)
à # Convert it to a binary string (in correct order..)
{ # Loop over each of these bits as characters:
ENR** # Push 15*25*29=10875
╦ # Get the dictionary word at this index: "buffalo"
\ # Swap so the current bit is at the top of the stack
i # Convert it from a character to an integer
╛ # If it's truthy:
δ # Titlecase the string
awk, 22- or 41-bytes. basic approach is 41-bytes:
echo Buffalo |
mawk 'NF+=sub(" ",OFS=" "tolower($2=$4=$1)" ")'
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo
but if we're going with the entirely hard-coded approach, that can massively cut it down to just 22-bytes (and that's already inclusive of the single quotes for OFS) :
echo BbBbbbBb |
mawk NF++ FS= OFS='uffalo '
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo
Trivia tidbit - if we view "B"'s as "1"'s and "b"'s as "0"'s,
then the requirement would appear 10100010, while its decimal form can be reached via either
2 * ( 3 ^ 4 ) or 3 * 6 * 9
R, 48 bytes
Similar to Dominic van Essen's recycling solution, but with paste0.
cat(paste0(scan(,''),'uffalo'))
B
b
B
b
b
b
B
b
Same idea, also 48 bytes
cat(paste0(scan(,''),'uffalo buffalo'))
B
B
b
B
Excel, 49 bytes
=TEXTJOIN(" ",,CHAR(98-{4;4;0;4}*{8,0})&"uffalo")
Explanation
98-{4;4;0;4}*{8,0} => 66 98 CHAR()=> B b
66 98 B b
98 98 b b
66 98 B b
Shortest Alternative, 51 bytes
=TEXTJOIN(" ",,MID("BbBbbbBb",ROW(1:8),1)&"uffalo")
05AB1E, 13 bytes
Inspired by @Leo's answer, so make sure to upvote him! and me too please ;)
Ƶzbε'±ˆsi™]ðý
Ƶzbε'±ˆsi™]ðý # full program
ý # join...
'±ˆ # "buffalo"...
ε # for map over all digits of...
Ƶz # 162...
b # in binary...
™ # in title case...
i # if...
s # current digit in...
ε # map over all digits of...
Ƶz # 162...
b # in binary...
i # is 1...
ð # by spaces
] # exit if statement and map
# implicit output
Boring, trivial alternative, 64 bytes
"Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo
"... # full program
"... # literal
# implicit output
EDIT: I have stood unbeaten for three months... Brownie points to anyone who outgolfs me.* Oh, and possibly some rep if I like your answer. ;)
*Just to clarify, outgolfs in any language will be accepted. It doesn't have to be 05AB1E.
JavaScript (V8), 57 50 bytes
a='uffalo';b='B'+a+' b'+a;c='b'+a;print(b,b,c,c,b)
You have to run these at Try it online! because running it in a browser console will try to print this webpage
57 bytes:
a='uffalo ';b='B'+a+'b'+a;c='b'+a;print(b+b+c+c+b.trim())
47 bytes but Try it online! doesn't understand String.replaceAll and it outputs a trailing space:
print('B'+('bBbbbBb'.replaceAll('','uffalo ')))
46 bytes but it outputs a trailing space (thanks to @lm42):
print('B'+('bBbbbBb'.replace(/|/g,'uffalo ')))
This is my first golf.
BRASCA, 30 bytes
`bBbbbBbB`[o` olaffu`7[aoA{]x]
Explanation
`bBbbbBbB` - Push the first letters of each [Bb]uffalo
[ ] - While non-zero:
o - Output the b/B
` olaffu` - Push "uffalo "
7[aoA{]x - Output it and clean up the counter
VBScript, 68 bytes
s="'BbBbbbBb'":k=""
For i=1 To Len(s)
k=k&Mid(s,i,1)&"uffalo "
Next
Deadfish~, 463 bytes
{{i}dddd}iiiiiic{{i}ddddd}ic{d}dddddccdddddc{i}iciiic{{d}ii}ic{{i}dddd}iiiiiic{i}{i}dc{d}dddddccdddddc{i}iciiic{{d}ii}ic{i}{i}{i}iiiic{{i}ddddd}ic{d}dddddccdddddc{i}iciiic{{d}ii}ic{{i}dddd}iiiiiic{i}{i}dc{d}dddddccdddddc{i}iciiic{{d}ii}ic{{i}dddd}iiiiiic{i}{i}dc{d}dddddccdddddc{i}iciiic{{d}ii}ic{{i}dddd}iiiiiic{i}{i}dc{d}dddddccdddddc{i}iciiic{{d}ii}ic{i}{i}{i}iiiic{{i}ddddd}ic{d}dddddccdddddc{i}iciiic{{d}ii}ic{{i}dddd}iiiiiic{i}{i}dc{d}dddddccdddddc{i}iciiic
Whispers v2, 69 bytes
> "BbBbbbBb"
> "uffalo "
> -1
>> L+2
>> Each 4 1
>> 5ᶠ3
>> Output 6
StupidStackLanguage, 89 84 bytes
avvqmddlblbqaviqvmlblblqqqaviqvmlblblaviqvmlblbtfavvdqvdmfwwwffwfvvifiiifbvvvvdfbbbu
AWK, 52 bytes
BEGIN{B="Buffalo";b="buffalo";print B,b,B,b,b,b,B,b}
I could not come up with a shorter example.
C (gcc), 62 bytes (using binary properties)
n=8;f(){while(n--)printf("%cuffalo%c",98^(n==3^n&1)<<5,9+!n);}
Explanations:
- 98 is 'b'
- If we clear bit
1<<5(32) from 'b' we obtain 'B':'b' ^ (1 << 5) = 'B'). This property is true for all letters. - We want to clear this bit when n = 7, 5 and 1, which means when n is odd:
n&1with the exception iteration: 3n==3^ 9+!nallows to have spaces (horizontal tab) except when n == 0:!n, then this expression will equal to 10 which is a new line return'\n'.- When n == 0 the
while(n--)loop will automatically stops.
Thanks to caird coinheringaahing for catching the superfluous extra newline ;)
Rattle, 51 46 42 bytes
Rattle just hit release today - this is my first golf with the released version! If you're interested in learning a fun and easy new language, I would highly recommend checking it out!
B&b&uffalo& |I=[b0[2b^b1]b2b3b1b2[3q]b3+]4
Try to out-golf me! You'll probably want to consult the documentation
Explanation
B&b&uffalo& creates an array of hard-coded strings: ["B","b","uffalo"," "]
| syntax for taking input
I stores this data in first memory slots
= sets top of stack to 0
[ ... ]4 loops 4 times
b0 adds item in slot 0 to buffer
[2 ... ] executes statements inside if top of stack is equal to 2
b^ deletes last item from buffer
b1 adds item in slot 1 to buffer
b2b3b1b2 adds item in slot 2, 3, 1, 2 to buffer
[3 ... ] executes statement inside if top of stack is equal to 3
q ends program - buffer is implicitly printed
b3 adds item in slot 3 to buffer
+ adds 1 to top of stack
Kotlin, 63 bytes
fun main(){"BbBbbbB".map{print(it+"uffalo ")};print("buffalo")}
I used the fairly common strategy of concatenating the first letter to "uffalo", but I had to print the last one to avoid trailing white space, I'm yet to find a better solution.
x86-16 machine code, IBM PC DOS, 35 33 32 bytes
00000000: b820 09b1 e7ba 1801 cd21 d0e9 7409 7303 . .......!..t.s.
00000010: 3044 19cd 29eb f1c3 4275 6666 616c 6f24 0D..)...Buffalo$
Listing:
B8 0920 MOV AX, 0920H ; AH = 9 DOS string function, AL = ' '
B1 E7 MOV CL, 11100111b ; magic buffalo number 11100111
BA 0118 MOV DX, OFFSET BUF ; 'Buffalo' pointer for display
STAMPEDE:
CD 21 INT 21H ; write our *uffalo to screen
D0 E9 SHR CL, 1 ; LSB of magic buffalo number into CF
74 09 JZ BYE_BUFFALO ; loop until CL is 0
73 03 JNC HI_BUFFALO ; if LSB bit is a 0, don't change case
30 44 19 XOR [SI+BUF-100H], AL ; swap case on first letter
HI_BUFFALO:
CD 29 INT 29H ; if not last of the buffalo, display a space
EB F1 JMP STAMPEDE ; keep 'em coming
BYE_BUFFALO:
C3 RET ; return to DOS
BUF:
DB 'Buffalo$' ; the real Buffalo
Explanation:
Uses the byte 0xe7 (1110 0111 binary) to determine if the case should be swapped. Each [Bb]uffalo corresponds to the next least significant bit of the byte where a 1 means to change the case and a 0 means don't change.
The case of the first character can be alternated by doing an xor 0x20 on the ASCII value. Now 0x20 just happens to be the ASCII value for a space character, so we can put that in al and use for both the xor and to write the space character.
Props:
- -1 byte thx to @peter ferrie!
Javascript, 57 bytes
console.log('BbBbbbBb'.replace(/./g, '$&uffalo ').trim())
If a trailing space is allowed, it can be 50 bytes:
console.log('BbBbbbBb'.replace(/./g, '$&uffalo '))
ThumbGolf, 31 bytes
Machine code (little endian pairs):
a005 22ba 0852 bf2c 2162 2142 de11 de00
d001 de3b d1f6 4770 6675 6166 6f6c 00
Commented assembly:
// Include ThumbGolf wrapper macros
.include "thumbgolf.inc"
.globl main
.thumb_func
main:
// r0 = "uffalo"
adr r0, .Luffalo
// Bitmask representing the case of the B.
// 0 = B, 1 = b, little endian bit order.
// Also allows us to determine the length.
// This fits perfectly into a narrow movs.
// bBbbbBbB
movs r2, #0b10111010
.Lloop:
// Read a bit from the bitmask into the carry flag by shifting right.
// Also detects when we have read all of the bits: lsrs will set the
// zero flag.
lsrs r2, r2, #1
// r1 = (r2 & 1) ? 'b' : 'B'
ite cs
movcs r1, #'b'
movcc r1, #'B'
// print either 'b' or 'B'
putc r1 // udf #0021
// print "uffalo" (w/o newline)
puts r0 // udf #0000
// Yes, none of the output instructions affect the flags despite using
// stdio AND executing the stdio call on the main thread (since stdio in
// signal handlers is unsafe), and this is proof.
//
// If the bitmask is zero, exit.
it eq
bxeq lr
// Use the "put special" instruction to print a space.
putspc ' ' // udf #0073
// More flexing that the flags are preserved, it is just as good to do
// `b .Lloop`.
// The proof is that this won't crash, since the ASCII as code will store
// random garbage to uninitialized registers.
bne .Lloop
// string literal
.Luffalo:
.asciz "uffalo"
Mostly a demo to show how ThumbGolf preserves the condition flags on output instructions.
I could do the same thing with cbz and an unconditional b, but this is a nice party trick.
As I explained in the code, I use a bitmask to control whether Buffalo or buffalo is printed. It just happens to be a perfect 8-bit constant for movs.
brainfuck, 226 bytes
--[++>+[<]>+]<++++[>++++++++<-]>>>---->-[<++>>++>++<<-----]->>>----[<<<+++++>>>--]----->++++++>+++++++++>-[<<<++>++>++>-----]<[<]>>.>>[.>]<[<]>.>>[.>]<[<]>.>.>>[.>]<[<]>.>>[.>]<[<]>.>>[.>]<[<]>.>>[.>]<[<]>.>.>>[.>]<[<]>.>>[.>]
The cells are set to <space>Bbuffalo
<[<]> Goto the space cell
. (dot = print a space)
>. (dot = print B)
>. (dot = print b)
>[.>] print uffalo
Buffalo is printed using <[<]>.>.> >[.>] but is this if it is the first time, we use <[<]> >.> >[.>]
buffalo is printed using <[<]>.> >.>[.>] but we can golf this to <[<]>.> > [.>]
The only thing that I can think of that could probably be better golfed is the preparation part.
If you put the B before the space you might be able to save some bytes.
Julia REPL, 33 bytes
join("BbBbbbBb ","uffalo ")[1:63]
Julia, 40 bytes
print(join("BbBbbbBb ","uffalo ")[1:63])
JavaScript ES6, 51 bytes
(c=n=>n?c(n>>1)+'bB'[n&1]+'uffalo ':'')(162).trim()
Made sure to trim a trailing space. If we don't trim it, we get 44 bytes (but of course that violates the problem description).
Pyth, 23 22 bytes
Save a byte thanks to @Scott!
V"BbBbbbBb"p+N"uffalo
I wanted to be smart and encode the state of the upper- and lowercase letters as bits, but that ended up taking a byte more. Here's the code and explanation anyway!
24 bytes
FNj162 2p+?N\B\b"uffalo
FN # loop with N
j162 2 # convert 162 into binary as list of bits
p # print without newlines
+ # concatinate strings
?N\B\b # ternary operator, checks if the bit is falsey (0)
"ufallo # note the trailing space
Java (JDK), 49 bytes
v->"B b B b b b B b".replaceAll("\\w","$0uffalo")
Credits
- -14 bytes thanks to Kevin Cruijssen
- -1 byte thanks to Jo King
TeX, 34 bytes
\def~{uffalo }B~b~B~b~b~b~B~b~\bye
jq, 35 characters
"BbBbbbBb "/""|join("uffalo ")[:-2]
Sample run:
bash-5.0$ jq -nr '"BbBbbbBb "/""|join("uffalo ")[:-2]'
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo
Whispers v2, 86 79 bytes
> "Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo"
>> Output 1
Well, this is embarrassing...
The first line alone could even be enough, as a function returning the string
For something a bit more interesting, here's my previous solution:
Whispers v2, 86 bytes
> "Buffalo "
> "buffalo "
>> 1+2
>> 3+3
>> 2+2
>> 5+3
>> 4+6
> 63
>> 7ᶠ8
>> Output 9
First approach to the language of the month for me :) It looks like building the string by manually concatenating pieces is the best approach in Whispers.
Explanation
Whispers starts the execution from the last line of the program, and then follows references from there. Any number in a line starting with >> refers to the result of the corresponding line, while numbers in lines starting with > have their normal value. We can only have a single operation per line (hence why so many lines).
Most lines here simply concatenate two strings, while line 9 takes the first 63 characters from the string in line 7, which is all except for the trailing space. It should be pretty easy to read, but here's the value computed by each line:
> "Buffalo " 1:"Buffalo "
> "buffalo " 2:"buffalo "
>> 1+2 3:"Buffalo buffalo "
>> 3+3 4:"Buffalo buffalo Buffalo buffalo "
>> 2+2 5:"buffalo buffalo "
>> 5+3 6:"buffalo buffalo Buffalo buffalo "
>> 4+6 7:"Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo "
> 63 8:63
>> 7ᶠ8 9:"Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo"
>> Output 9 10:prints out line 9
K (ngn/k), 27 25 bytes
-2 bytes thanks to ngn!
" "/"BbBbbbBb",\:"uffalo"
J, 30 bytes
echo}:,/'BbBbbbBb',"{'uffalo '
C#, 131 bytes
using System.Linq;using System;class A{static void Main(){Console.Write($"{String.Join("uffalo ", "BbBbbbBb".ToArray())}uffalo");}}
x86-16 machine code, 43 42 41 bytes
-1 byte thanks to @CodyGray.
-1 byte thanks to @640KB.
0BED:0100 BA 19 01 BE 22 01 B4 09-B1 07 CD 21 AC A2 19 01 ...."......!....
0BED:0110 E2 F8 C6 44 F7 24 CD 21-C3 42 75 66 66 61 6C 6F ...D.$.!.Buffalo
0BED:0120 20 24 62 42 62 62 62 42-62 $bBbbbBb
Instruction listing (nasm syntax):
org 100h ; | Execution of .COM files start at CS:0100
mov dx, msg ; BA 1B 01 | DX = offset of "Buffalo $" (for INT 21H)
mov si, buf ; BE 24 01 | SI = Address of "bBbbbBb" (for LODSB)
mov ah, 09h ; B4 09 | AH = Opcode code INT 21H (Output string up to '$')
mov cl, 7 ; B1 07 | CX = 7 (we want to iterate 7 times before the last 'Buffalo')
loop:
int 21h ; CD 21 | Output string at msg
lodsb ; AC | AX = [SI], ++SI
mov byte [msg], al
; A2 1B 01 | Set the first character of msg as the current character at buf
loop loop ; E2 F8 | Jump to tag 'loop' while CX >= 0
mov byte [si - 9], "$"
; C6 44 F7 24 | (After loop) Replace the last space with a '$'
int 21h ; CD 21 | Print the last 'buffalo'
ret ; C3 | Exit to DOS
msg: db "Buffalo $"
buf: db "bBbbbBb"
Example run
C:\test>debug code.com
-g
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo
Program terminated normally
Bubblegum, 17
Obligatory bubblegum answer generated with zopfli --deflate --i1000 -c buffalo.txt | xxd
00000000: 732a 4d4b 4bcc c957 4882 d2e8 fc24 fcf2 s*MKK..WH....$..
00000010: 00 .
Haskell, 30 bytes
init$"BbBbbbBb">>=(:"uffalo ")
Clojure, 60 bytes
(clojure.string/join " " (map #(str % "uffalo") "BbBbbbBb"))
Python 3, 117 bytes
o=['buffalo']
for x in ['B' if int(i) else 'b' for i in bin(69)[:1:-1]]:
o.insert(0,x+o[-1][1:])
print(' '.join(o))
69 is the reverse of the binary representation of the capitalization pattern.
R, 40 39 bytes
Edit: -1 byte thanks to Dingus
cat(c('buffalo','Buffalo')[1+!21%%1:8])
Chooses whether to output 'buffalo' or 'Buffalo' by indexing with the vector 2 1 2 1 1 1 2 1, which is constructed as the zero values of 21 modulo each of 1...8, plus one.
Sadly, trying to recycle the 'uffalo' is significantly longer (54 bytes) due to R's somewhat cumbersome string-manipulation functions (Edit after reading the 'Anarchy Golf' link: still longer, but can be done in 46 bytes)
C (gcc), 62 61 bytes
Realised the 61 byte version was not compliant (outputted a space at the end). Reverted and updated it to be.
-1 byte thanks to Arnauld
f(n){for(n=8;n--;)printf("%cuffalo%s","bBbbbBbB"[n]," "+!n);}
T-SQL, 45 51 47 bytes
PRINT REPLACE('B0 B0 b0 B0',0,'uffalo buffalo')
PRINT is shorter than SELECT. Using a numeral in the REPLACE eliminates a set of quotes and saves 2 bytes.
EDIT: Fixed trailing space, at the cost of 6 bytes. Saved 4 by replacing a longer phrase, thanks @Giuseppe
Python 3, 72 bytes
print('Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo')
I mean, that works.
C++11, 126 bytes
#include<random>
#include<cstdio>
int main(){std::knuth_b g(7);for(char i{},s[]=" buffalo";i-8;++i)s[1]^=*s&g(),printf(s+!i);}
Not a serious contender for shortest program — but I was inspired by the (original, now-deleted) requirement not to use a random number generator. ;)
brainfuck, 370 bytes
>++++++++[>++++++++<-]<++++++++[>++++<-]>>++.--------[>++>++<<-]>+.>--------------..[>+>+>+<<<-]>-----.>++++++.+++.<<<<<.>>>>+.<<.>>>>..<<-.>---.+++.<<<<<.>++++++++[>>++++++++<<-]>>++.<.>>>>..<<.>---.+++.<<<<<.>>>>+.<<.>>>>..<<-.>---.+++.<<<<<.>>>>+.<<.>>>>..<<-.>---.+++.<<<<<.>>>>+.<<.>>>>..<<-.>---.+++.<<<<<.>>>.<.>>>>..<<.>---.+++.<<<<<.>>>>+.<<.>>>>..<<-.>---.+++.
Not exactly the most optimized answer and could probably be golfed much further. Makes lots of use of copying cells, as well as repeadedly performing the same print function near the end.
Original un-minified version (sadly uncommented) can be found here.
LabVIEW, 20 bytes
Graphical languages are harder to count, so here's my attempt:
- 1 byte loop termination
- 1 byte for the loop
- 1 byte for the integer we encode the capitalization in
- 6 bytes for the 'uffalo' string
- 1 byte for the mask we apply to the integer encoding
- 1 byte for the case structure
- 1 byte for the AND
- 1 byte for the left shift function
- 2 bytes for the capital and noncapital letters in the case structure
- 1 byte for the concatenate string function
- 2 bytes for format string spec
- 1 byte for the delimiter (space)
- 1 byte for the array to spreadsheet string function
And yes, how'd you know about my EE degree?
Python 3, 39 bytes
print('uffalo '.join('BbBbbbBb ')[:-2])
Potentially invalid, 35 bytes
print('uffalo '.join('BbBbbbBb\b'))
Whispers v2, 98 bytes
> 81
> 2
>> 1⊥2
> "Buffalo "
> "buffalo "
> "buffalo"
>> If L 4 5
>> Each 7 3
>> 8+6
>> Output 9
V (vim), 20 bytes
8ibuffalo <esc>xbb~5b~0~
8ibuffalo <esc>, write "buffalo " 8 times. cursor at end of line.xremove current character (the space at end of line).bbmove to the 2nd words beginning from cursor (move left).~toggle letter case, and also move cursor 1 char right.5b~move to the 5th words beginning from cursor (move left). And toggle case.0~move to line beginning. And toggle case.
Julia, 42 bytes
join(collect("BbBbbbBb").*"uffalo ")[1:63]
Very similar to what was done with Python above.
Bash, 28 bytes
echo {B,b,B,b,b,b,B,b}uffalo
Brace expansion (Bash Reference Manual)
Same length, slightly more interesting:
echo {B,b,B,b{,,},B,b}uffalo
Python 2, 36 bytes
for c in'BbBbbbBb':print c+'uffalo',
Relies on the Python 2 print magic that automagically adds a space before a printed object if it thinks it's not at the beginning of a line.
Python 2 (anagol), 36 bytes
print'uffalo '.join('BbBbbb'*2)[:63]
A trivial modification of the anagol solution is the same length.
Python 3, 38 bytes
print(*[x+'uffalo'for x in'BbBbbbBb'])
Python 3, 41 bytes
print(*map("{}uffalo".format,'BbBbbbBb'))
C (gcc), 63 bytes
-2 bytes thanks to @Arnauld
n=7;f(){printf("%cuffalo%c","bBbbbBbB"[n],9+!n),n--?f():(n=7);}
Could have been shorter if it wasn't for the reusability rule killing recursive functions.
Wolfram Language (Mathematica), 48 bytes
##<>#&//"B"~Print~#["uffalo"~#~b~#~" B",b=" b"]&
Port of TiKevin83's TI-BASIC solution.
Stax, 16 bytes
Æ▼.#t!♦ΩÿN+╪\7êI
Uses mixed base conversion and some zipping.
Made with a lot of @recursive's help.
APL+WIN, 21 bytes
'BbBbbbBb',¨⊂'uffalo'
Try it online! Thanks to Dyalog Classic
This could be shortened to 5 bytes if the two strings were given as input rather than being hard coded.
Red, 57 bytes
prin collect[foreach b"BbBbbbBb"[keep rejoin[b"uffalo"]]]
Alternative:
Red, 60 bytes
parse s:"B b B b b b B b"[any["b"insert"uffallo"|" "]]prin s
JavaScript (ES6), 46 bytes
Builds the string recursively and in reverse order.
f=n=>(n>6?'':f(-~n)+' ')+"bB"[n&n!=3]+'uffalo'
Alternate version
f=n=>(n>6?'':f(-~n)+' ')+"bB"[25/n&1]+'uffalo'
Commented
f = n => // f is a recursive function taking a counter n,
// which is initially undefined (zero'ish)
( n > 6 ? // if n is greater than 6 (last iteration):
'' // append nothing
: // else:
f(-~n) // append the result of a recursive call with n + 1
+ ' ' // followed by a space
) //
+ "bB"[n & n != 3] // append "B" if n is odd and not equal to 3,
// or "b" otherwise
+ 'uffalo' // append "uffalo"
Batch, 50 49 bytes
@set s=B_b_B_b_b_b_B_buffalo
@echo %s:_=uffalo %
Batch's string handling is so poor it's golfier to explicitly include the last "buffalo" rather than trying to trim the trailing space at the end.
TI-BASIC, 47 bytes
"uffalo
Ans+" b"+Ans
Ans+" B"+Ans
"B"+Ans+" b"+Ans
Builds the sentence up in chunks to eliminate the need for string variables which are two byte tokens; Ans is always a single byte even when it holds a string. The strategy also minimizes use of the lowercase letters as they are two byte tokens. The final line is automatically output and you can scroll left-right for the full sentence.
Perl 5, 32 bytes
@_=<{,b,B,b}uffalo>;say"B@_ b@_"
Beats the best anagol answer by one byte:
@_=($_=Buffalo,lc)x2,print"@_ \l@_." # Mithran
@_=<{,b,B,b}uffalo>;print"B@_ b@_." # Sisyphus
Husk, 14 bytes
wM?Im_ḋ162¨Ḃ=F
This was a simple challenge but fun :)
Explanation
wM?Im_ḋ162¨Ḃ=F
¨Ḃ=F Taking the compressed string "Buffalo" (uppercase B)
M For each digit in
ḋ162 the binary digits of 162 ([1,0,1,0,0,0,1,0]):
? if the digit is 1
I return the string itself
if the digit is 0
m_ convert each character to lowercase
w Join all strings with spaces
Charcoal, 16 bytes
F⍘¹⁶²bB«ιuffalo→
Try it online! Link is to verbose version of code. Explanation:
F⍘¹⁶²bB«
Convert 162 to base 2, but use b for 0 and B for 1, and loop over the "digits".
ι
Print the b or B.
uffalo
Print the rest of the buffalo.
→
Prepare to leave a space before the next b, if any.
Retina 0.8.2, 25 bytes
BbBbbbBb
.
$&uffalo
$
Try it online! Explanation:
BbBbbbBb
Insert the bs in the correct capitalisation.
.
$&uffalo
Expand the buffalo (buffaloes?).
$
Remove the trailing space.






