I've tried many different things but it seems no matter what I do, my first 'if' statement is always true, even when it should be false. This problem occurs in the following code,
Your condition will be true if one or more of the elements of board is 'X'. Are you absolutely certain that every single one of those 9 elements is something other than 'X' ?
Whatever you want to check for the first if evaluates to true if 'X' is anywhere on the board. The ideal time to determine whether the winner is X or Y O is when you're checking to see if there's a winner.