Your code gives the incorrect output for the following input:
X | |
---------
X | | O
---------
| O |
If I get the best move for the computer (X), it lists spot 1, which is incorrect (it's obviously spot 6, to win). It does give the correct output for the human player (spot 6, to block the computer), though.
Here's my "origBoard" input. it follows the format you specified in the article and in the code itself.
var origBoard = ["X",1, 2,"X",4 ,"O", 6 ,"O",8];
I'm running Chrome 70 on MacOS.
Your code gives the incorrect output for the following input:
If I get the best move for the computer (
X), it lists spot 1, which is incorrect (it's obviously spot 6, to win). It does give the correct output for the human player (spot 6, to block the computer), though.Here's my "origBoard" input. it follows the format you specified in the article and in the code itself.
var origBoard = ["X",1, 2,"X",4 ,"O", 6 ,"O",8];I'm running Chrome 70 on MacOS.