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 |
Results tagged with code-golf
Search options not deleted
user 39407
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
1
vote
Merge two values
Glee, 24 22 20 bytes
Idea to append zero taken from Sok’s Pyth solution.
=>n,0& *>0\+ >1~ *n\>>
=>n,0& *>0\+ <2*n\>> $$<2 instead of >1~ (not > 1)
Explanation:
a b=>n,0& *>0\+ <2*n\>>
a b …
0
votes
Merge two values
Q'Nial7, 40 bytes
n is OP A B{2>sum(cull A B 0>0)*max A B}
n is OP A B{ } operation n with parameters A B (pair of numbers)
A B 0 ap …
2
votes
The "Do While False" idiom
beeswax, 26 bytes
Interpreting 0 as false, 1 as true.
E`<
D`d"`C`~<
_T~T~`A`"b`B
Output:
julia> beeswax("codegolfdowhile.bswx",0,0.0,Int(20000))
i1
i1
AB
Program finished!
julia> beeswax("codegolfdo …
1
vote
Shortest auto-destructive loop
DUP, 10 bytes (8 chars)
Conor O'Brien already wrote the shortest possible solution in FALSE which is also a valid DUP program. DUP is a direct descendant of FALSE and FALSE is almost a complete subse …
1
vote
Play the "bzzt" game
beeswax, 148 bytes
beeswax was created after the challenge, but why shouldn’t I give the challenge a try anyway? ;)
Not golfed to death yet, but it satisfies both requirements:
;pK~gFP{?gp' …
1
vote
Shortest auto-destructive loop
Julia, 19 bytes
for i=1:2 "a"[i]end
The first loop accesses string "a" at index [1], which is char 'a', the second loop tries to access string "a" at index [2] and throws a BoundsError:
julia> for …
3
votes
Shortest code to produce infinite output
Piet, 3 codels
==> <== here it is ;)
Just to make it visible, the same at codel size 10:
This program bounces forward and backward, executing:
forward direction:
1
PSH (push on stack)
OUN (ou …
0
votes
Shortest code to produce infinite output
Cardinal, 3 characters
.%$
Explanation:
. print active value
% start pointers here
$ jump to x,y = active, inactive value
.%$
Pointers spread out in all cardinal directions from every …
2
votes
Shortest infinite loop producing no output
beeswax, 3 bytes
O_O
or alternatively
j_j
or
>_<
All three create two bees that get reflected back and forth indefinitely.
1
vote
Shortest infinite loop producing no output
DUP, 6 bytes
[1][]# {infinite while loop}
This is a proper and implementation independent solution.
Mama Fun Roll’s 2 byte solution only works with the quirkster Javascript …
1
vote
Shortest infinite loop producing no output
Q'Nial7, 22 bytes
WHILE =1 DO 1 ENDWHILE
1
vote
Shortest infinite loop producing no output
Cardinal, 2 bytes
%$
or
$%
In Cardinal each pointer carries exactly 2 unsigned 8 bit values, one active, one inactive. Both are initialized to 0
% creates 4 pointers moving in the cardinal direction …
1
vote
Shortest infinite loop producing no output
Staq, 2 bytes
()
( jump to corresponding ) if the top stack value is greater than 0
) jump back to corresponding ( if the top stack value is 0 (or if it does not exist)
0
votes
Shortest infinite loop producing no output
HPPPL, 16 bytes
while 0=0 do end
2
votes
Shortest infinite loop producing no output
beeswax, 3 or 4 bytes
A real loop (4 byte solution)
*PFJ
Explanation:
* Generate IP, moving to the right. [0,0,0]•
P Increment top local stack value. [0 …