Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
6
votes
EvenSt-ring C ode - g ol!f
Brain-Flak, 138 114 112 84 + 3 = 87 bytes
Thanks to @Riley for help golfing.
This program treats empty input as a noneven string.
{({}(())){({}[()]<(()[{}])>)}{}(({})<>[[]{}]()){{}(<>)}{}({}<>)<>}<>(( …
4
votes
EvenSt-ring C ode - g ol!f
Starry, 85 bytes
, + * ` , + + * ' + ' ` + * + + * ' + `.
Try it online!
Note that since a Starry program has no way of telling when an input of arbitrary …
4
votes
Bootstrap JSF**k
Brainfuck, 5 bytes
+[+.]
Try it online!
Explanation
Increments the byte under the data pointer, then loops while the byte under the data pointer is not zero (until the value overflows and gets back t …
1
vote
Add two numbers
Whirl, 32 bytes
01100100001100011110001000111100
Try it online!
Explanation
Whirl has two "rings" of operations, one for control and I/O operations and the other for math operations. The 1 command ro …
2
votes
This challenge uses the '+' character
Brain-Flak, 216 + 1 = 217 bytes
+1 bytes from the -A flag
([{}]())(()()){<>(((((()()()()()){})){}()){}())<>(({}[()])<({}<(({})){({}()<(({}<<>(({}<(({})<>)>)<>)<>>)<{({}()<(((((()()){}){}){}){})>)}{} …
1
vote
Generate Men of Culture
Prolog (SWI), 109 bytes
[]+[]+[].
I+[B|X]+[C|O]:-(I=[B|J],B=C;I=J,C=45),J+X+O.
I-O:-I+`Ah, I see you're a man of culture as well.`+O.
Try it online!
Case-sensitive and whitespace sensitive. The -/ …
1
vote
Converting a number from Zeckendorf Representation to Decimal
Prolog (SWI), 74 bytes
\D-->[X,Y],{D is 2*X+Y};[D];a,\D.
a,[A],[B]-->[X,Y,Z],{A is X+Y,B is X+Z}.
Try it online!
Takes input as a list of integers 1 and 0 with the most significant bit first.
1
vote
Tips for golfing in Pure Data
Avoid using triggers to sequence messages
One of the common uses of trigger objects is to make the order of execution clear when a single object is sending messages to multiple places. In those cases …
1
vote
Code golf edit distance up to 3
Prolog (SWI), 109 bytes
_+[]+[].
N+[A|B]+[A|C]:-!,N+B+C.
\N+B+C:-B=[_|X],N+X+C;C=[_|Y],N+B+Y;B=[_|X],C=[_|Y],N+X+Y.
B*C:- \ \ \a+B+C.
Try it online!
This is a golf of Wheat Wizard's answer. The key m …
15
votes
Tips for golfing in Prolog
Use Operators for Predicate Names
It is possible to give predicates operators as names so long as the operator is one of the predefined operators (listed here) and is not already defined as a predicat …
4
votes
Incrementally Increment Identical Integers
Prolog (SWI), 75 66 bytes
B+A,[C]-->[A],{C is A+B},B+1+A;[X],{C=X},1+X.
_+_-->[].
a-->0+x,!.
Try it online!
This program can be run by calling the grammar a//0 to parse the input list. The remainder …
4
votes
Tips for golfing in TikZ
Use \tikz instead of the tikzpicture environment
Instead of creating a tikzpicture environment (36 bytes) you can use the \tikz command (7 bytes)
Global options can be set in square brackets in usin …
3
votes
As Easy As A-B-C
Brain-Flak, 120 + 3 = 123 bytes
<>((((((((()()){}){}){}){}){}())())())<>{({}(<()>)){(([({})]<>({}))){(<({}<>{})<>([{}]{}<>)>)}{}}{}{}<>{}{({}<>)<>}{}}<>
It is run with the -c flag, adding 3 bytes
Try …
2
votes
n-th term of the rise & reset sequence
Brain-Flak, 46 bytes
Zero indexed
(<>()){(({}())[()]){({}[()])<>}{}}<>([{}()]{})
Try it online!
Stack Clean, 48 bytes
(<>()){(({}())[()]){({}[()])<>}{}}{}<>([{}()]{})
Try it online!
Explanation
This …
6
votes
Division and remainder
Brain-Flak, 56 54 bytes
({}<>)<>([()]{()<(({})){({}[()])<>}{}>}<><([{}()]{})>)
Try it online!
-2 bytes thanks to Wheat Wizard
Explanation
The current best known integer division and modulo in Brain-F …