Ask coding questions

← Back to all posts
5
1 line code challenge

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

Commentshotnewtop
3
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

1

@gantr833

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

Swift:

fatalError("lol")
1

print ("Hello World")

:)

1

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

1

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

1

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)