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.
2
votes
Draw an ASCII chess board!
Python, 69 bytes
n='\n'
p,a='p'*8+n,'rnbqkbnr'+n
print a+p+('.'*8+n)*4+(p+a).upper()
There are two things that frustrate me with this code: the print and "upper". Wouldn't an up function be cool? Any …
0
votes
Print an alphabet wave
Python, 56
for k in range(26):print(chr(k+65)+chr((k+1)%26+65))*13
2
votes
Walk the words!
Python 3, 314 309 290 268 Bytes
x=y=0
d,m=(1,0),{}
q={'u':(0,-1),'d':(0,1),'l':(-1,0),'r':d}
for c in input():m[x,y]=c;d=q.get(c.lower(),d);x,y=x+d[0],y+d[1]
X,Y=zip(*m)
O,P=min(X),min(Y)
r,p=0,print
…
1
vote
How to randomize letters in a word
Coffee-script: 76 91 Bytes
f=(a)->a.length>1&&a[0]+(a.split('')[1..-2].sort ()->.5-Math.random()).join('')+a[-1..]||a
Wow, I like this language already.
2
votes
Please release me!
Coffee-script: 77 67 Bytes
f=(p,i)->((z<i&&v||z==i&&~~v+1||0)for v,z in p.split '.').join '.'
Woot! Time for cake and coffee for the beta release.
Thanks to @ven and @Cyoce I shaved 10 Bytes!
2
votes
Print the last answerer's first submission
17. EasyasPi, Python 3 2, 110 bytes
I realised that my first answer was written in Python 2 after I had posted. Here is the updated and golfed version.
import os,base64 as b
os.write(1,b.b64decode("5A …
2
votes
Tips for golfing in Binary Lambda Calculus
This is fairly obvious but I'll put it here for completeness sake. It also applies to untyped lambda calculus in general so I'll write it like that for readability.
Anywhere you want reuse a value/fun …
1
vote
"Hello, World!"
JSON, 16 bytes
"Hello, World!"
Apparently golfing doesn't need to be Turing-complete. Someone mentioned a meta-post but I took their word for it. And hey, this is the closest to STDOUT there is in JS …
1
vote
Build me a brick wall!
Python 2, 46 bytes
import textwrap as t;print t.fill('_|__'*175)
I was going to do an exec loop similar to @xnor's one alternate solution but he/she got to it before me. I guess I'll just have to let …
1
vote
Print all colorings of a 3x3 grid
Python 3, 123 121 109 103 bytes
Here is my old one:
import itertools
[print(a+b+c,d+e+f,g+h+i,'\n',sep='\n') for a,b,c,d,e,f,g,h,i in itertools.product(['X','.'],repeat=9)]
And here is my new one:
im …
1
vote
2D Dungeon Crawler
Coffee-script: 580 Bytes
I've squeezed everything I could out of this particular algorithm and my tired brain. I need a holiday.
C=console
e='length'
N=null
f=(S)->
x=y=X=Y=N
q=(c,v)->
…