I have a Tic Tac Toe game but I want it to be that you can choose whether to play aginst a computer or human and how would you make the computer player
You would have to create a function that 'simulates' a player. Try to write down for yourself which steps you take when your playing tictactoe:
1) can i win
2) can the other player win
3)...
and translate that into source code:
1 2 3 4 5
if (computer_can_win)
...
elseif (player_can_win)
...
else...
For the computer logic, you could try something along these lines:
1. find all 3-space paths not blocked by the user already
2. sort them in order of how many the computer has already
3. attempt to move to one of the "closest to winning" paths, picking one by random when there are multiple ranked the same.
Actually, you could increase the rank of moves that fit into multiple winning paths, too. Then it would be much more challenging!