Last active
February 10, 2020 12:48
-
-
Save WitherOrNot/86e885896864bf9658371b6a5f90334b to your computer and use it in GitHub Desktop.
Tic-Tac-Toe Python 2 Codegolf in 247 bytes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| o=w=0;s=" ";b=[s]*9 | |
| while 1: | |
| print"\n".join(["".join(b[x:x+3])for x in 0,3,6]) | |
| if w:break | |
| h=~-input();z=b[h]==s;b[h]=[b[h],"XO"[o]][z];o=[o,2+~o][z] | |
| for i in range(8): | |
| e,f,g=map(int,`0x341a4a6fa990a9ee254e`[i*3:][:3]);w|=(b[e]==b[f]==b[g]!=s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment