Hard coding is always should be avoided? [Tic-Tac-Toe]

My tic-tac-toe Project - http://codepen.io/ayamimu/full/vmZgwO/

Hello.
I’ll be glad if I could ask some opinions about the following.

I wanted to make the AI to be unbeatable with some known algolithm that not depend on the number of moves or ◯✕ position , but unfortunately I leaned on Hard coding.

This game has 3 difficulty levels.
In the case of EASY Level, AI hand is completely random.
But as the level become higher, I have get to given “constant number” and to used conditional statements frequently for limiting AI choices.
These numbers and conditional statements which found by writing some drawing of each state of the game out to paper.
As a result, a part of code was like this.

...
var jsonArr = JSON.stringify(userHands.sort());

// unsightly...
var isBetweenCorner = jsonArr === JSON.stringify([1, 5]) ||
                      jsonArr === JSON.stringify([1, 3]) || 
                      jsonArr === JSON.stringify([3, 7]) || 
                      jsonArr === JSON.stringify([5, 7]);

if (isBetweenCorner) {
  choices = this.board[Number(center)] === '' ? center : corners;
}
...

Obviously, to enumerate branches manually isn’t smart and forcible approach.
Because if number of squares in the board modify, I will have to fix my code.
I think it’s better that these constant numbers should be derived from computed result in reusable function.
But since there aren’t so many branches, I did it so this time.

In the actual job, Hard coding like this should be avoided absolutely?
And, What kind of approach you had been thinking when you worked on this project?

Thank you.