At the end a strategic defense computer is asked to play Tic Tac Toe against itself and suddenly "learns" about no-win scenarios. Then it does the same with nuclear launch scenarios, and finds that they're all no-win. It decides that nuclear war "is a strange game", and "the only winning move is not to play".
I think OP is referring to the 80's movie WarGames - https://en.wikipedia.org/wiki/WarGames
At the end a strategic defense computer is asked to play Tic Tac Toe against itself and suddenly "learns" about no-win scenarios. Then it does the same with nuclear launch scenarios, and finds that they're all no-win. It decides that nuclear war "is a strange game", and "the only winning move is not to play".