The rules have a hole: play a corner, then the opposite corner, and you can set a trap. Instead of more rules, the
computer will look ahead at every possible future. First it needs to score a finished game from O's point of view.
```js
// How good `cells` is for O if both sides play perfectly: 1 = O wins, -1 = X wins, 0 = draw.
function score(cells, turn) {
const end = outcome(cells)
if (end === 'O') return 1
if (end === 'X') return -1
if (end === 'draw') return 0
}
```
What it means
score(cells, turn) takes a board and whose turn it is (turn is used in the next step).
For a finished game it returns 1, -1 or 0. For a game still going it returns nothing yet.
Your turn
Above function computerMove, write the comment and score, with an empty line after it. Press Run.