New answers tagged

0

Zsh + bc, 54 bytes bc<<<$#1`tr a-z 02210313074020029000033739<<<${1///+}` Try it online! Pure Zsh, 55 bytes <<<$[$#1`tr a-z 02210313074020029000033739<<<${1///+}`] Try it online!


1

Python 3, 18 bytes lambda a:a+a%2*2-1 Try it online! This brilliant AI will always force a tie, and sometimes win if you let it. The grid is numbered in a spiral, like so: 1 2 3 8 9 4 7 6 5 and the computer always goes first. For the first move, input "10". This is a little redundant because it always goes in the same place, but it's already ...


0

Python 3: 341 bytes So, my first attempt of code golfing, nice challenge! I thought of something similar myself with a complete game in mind though. Here is the AI code: def e(b,t):return any([b[i]==b[i+d]==b[i+2*d]==t for i,d in((0,1),(3,1),(6,1),(0,3),(1,3),(2,3),(0,4),(2,2))]) def n(b,t,d=8): if e(b,t):return 0,1 if e(b,-t):return 0,-1 if all(...


Top 50 recent answers are included