> The solution is only about ~100 lines.
wins=. 9 3 $ 0 1 2 3 4 5 6 7 8 0 3 6 1 4 7 2 5 8 0 4 8 2 4 6
winner=. # e. 3 + wins #@-.~"1 ]
isover=. [: +./ ] winner/.~ 2 | #\
fullgame=. {.~ 1 + 1 i.~ isover\
all=. (i.!9) A. i.9
echo # ~. fullgame"1 all
https://tio.run/##NU3LDsFAFN3PVxxqQRq3Rh9UIuE7tItGBiOjTTRYkP...Or the 1-liner:
# ~. ({.~ 1 + 1 i.~ ([: +./ ] (# e. 3 + w #@-.~"1 ])/.~ 2 | #\)\)"1 (i.!9) A. i.9
which surely could be golfed even further.What's the language on the one-liner? I know nothing about J, but it doesn't seem to run. Sorry; just a bit fascinated.
It's J also. Link which will run:
https://tio.run/##JYyxDoJAEER7v@LpWdzl4iJwoJiY6HcIlSERG0sKDb...
Re:How to Interview Engineers
by abecedarius on Monday October 12, 2020 @04:54PM
(#24759328)
Shorter than that. https://gist.github.com/darius/8caf6b8ba3419350d533960dba563...
Saying typing speed is the bottleneck may be a bit of an exaggeration, but if you look at the leaderboard for Advent of Code, the leaders are incredibly fast.
(My result: 5 minutes, but I'm normally a lot slower than those leaders. I'd just already written a tictactoe program and only needed the count-games function.)
Re:How to Interview Engineers
by username90 on Monday October 12, 2020 @04:59PM
(#24759381)
Coding while talking is significantly slower than just coding though.
But I think his math doesn't work out. The solution is only about ~100 lines. If typing speed was the bottleneck, it would only take 2 or 3 minutes from start to finish.
> The most talented candidates will think about it for a few seconds, then write the program as fast as they can type (and they'll type fast). You can almost sense their frustration because they think way faster than the keyboard allows them to interface with the computer. Typing speed is their bottleneck. (...) The whole process will take about 10 minutes from start to finish.