I would imagine it has both. And since it’s much easier to play legal moves in tic-tac-toe (just find an empty square) it should be much easier. In fact there are less than 20k total tic-tac-toe games so unlike chess you could just memorize every game.
The fact that it can’t even do that tells us that it doesn’t have an internal board representation to reference.
https://pastebin.com/gSm0bbH9
It didn’t realize that it had won.