Ask coding questions

← Back to all posts
1 line code challenge
gantr833 (154)

Who can create the coolest thing in just one line of code.

Commentshotnewtop
chilaxan (5)
print(eval(f"(LB=Lc='X',b=L:int(input(a)),d=[*range(9)],e=Lp=print:[a,p('_'*7),[p('',*a[x:x+3],'',sep='|')for x in[0,3,6]]][0]:(Lb:[b]*9if 1in[all([b==a[int(x)]for x in str(list(map(ord,'ÒřʦɶơĂ͈ö'))[y])])for y in range(8)]else a)((Lb,c,d:[b.pop(c),b.insert(c,d),b][2])([e(d),e(a)],a,d.index(b(c)),c)if['X']*9!=a!=['O']*9else a,c):(L:'X'*(a==['X']*9)+'O'*(a==['O']*9)or'C')({'B('*9}[' ']*9){',a))'*4}))('O')".replace('L','lambda a,')))

One line tic tac toe

gantr833 (154)

@chilaxan: That's one long line! Nice job!

ChristianThone (34)

@gantr833

for i in range(1000): print("One Line Code Challenge. This line prints One-Thousand Times.")
gantr833 (154)

@ChristianThone: Very nice, I hope that doesn't crash my computer ;)

ash15khng (234)

Swift:

fatalError("lol")
John_WardWard (142)

print ("Hello World")

:)

SPQR (344)

is this a "the whole source file has to be one line" or a "the (cool/important/unique) stuff is on one line"?

gantr833 (154)

@SPQR: the whole thing you are creating on one line.

Nanashi (7)

Well, this is FizzBuzz in 59 characters of python 3:

for i in range(100):print(i%3//2*"Fizz"+i%5//4*"Buzz"or-~i)