Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

-3 bytes and updated explanation
Source Link
PunPun1000
  • 993
  • 4
  • 7

Brachylog, 24(削除) 24 (削除ここまで) 21 bytes

-3 bytes thanks to Erik the Outgolfer

↰1∧"goose"w
"duck"ẉ4ṙ0∨↰"duck"ẉ4ṙ0∧"goose"w∨↰

Try it online! Try it online!

In celebration of the Language of the month, my first brachylog post. The control flow in this language is cool.

Predicate 0How it works:

↰1∧"goose"w"duck"ẉ4ṙ0∧"goose"w∨↰
↰1"duck"ẉ Call predicate 1 print duck with a new line
  4ṙ and
 "goose"w print goose without choose a newline

Predicate 1:

"duck"ẉ4ṙ0∨↰random number in the range is [0, 4]
"duck"ẉ Print duck with a0 newline then verify it equals zero
 4ṙ  a random number in the range [0,4] and (short circuits)
 0 "goose"w is equal to zero print goose without a newline
 ∨ or (if it did not equal zero)
 ↰ repeat thisthe predicateprocedure
 

Brachylog, 24 bytes

↰1∧"goose"w
"duck"ẉ4ṙ0∨↰

Try it online!

In celebration of the Language of the month, my first brachylog post. The control flow in this language is cool.

Predicate 0:

↰1∧"goose"w
↰1 Call predicate 1
  and
 "goose"w print goose without a newline

Predicate 1:

"duck"ẉ4ṙ0∨↰
"duck"ẉ Print duck with a newline then
 4ṙ a random number in the range [0,4]
 0 is equal to zero
 ∨ or
 ↰ repeat this predicate

Brachylog, (削除) 24 (削除ここまで) 21 bytes

-3 bytes thanks to Erik the Outgolfer

"duck"ẉ4ṙ0∧"goose"w∨↰

Try it online!

In celebration of the Language of the month, my first brachylog post. The control flow in this language is cool.

How it works:

"duck"ẉ4ṙ0∧"goose"w∨↰
"duck"ẉ  print duck with a new line
 4ṙ choose a random number in the range is [0, 4]
 0  verify it equals zero
   and (short circuits)
 "goose"w  print goose without a newline
 ∨ or (if it did not equal zero)
 ↰ repeat the procedure
 
Source Link
PunPun1000
  • 993
  • 4
  • 7

Brachylog, 24 bytes

↰1∧"goose"w
"duck"ẉ4ṙ0∨↰

Try it online!

In celebration of the Language of the month, my first brachylog post. The control flow in this language is cool.

Predicate 0:

↰1∧"goose"w
↰1 Call predicate 1
 ∧ and
 "goose"w print goose without a newline

Predicate 1:

"duck"ẉ4ṙ0∨↰
"duck"ẉ Print duck with a newline then
 4ṙ a random number in the range [0,4]
 0 is equal to zero
 ∨ or
 ↰ repeat this predicate

AltStyle によって変換されたページ (->オリジナル) /