Have a couple of thoughts on this… but my main (and simplest) theory is that Q team has access to very advanced AI. Thats what I think the multiple Wargames and (more importantly) the game theory refrences..
Q said -
Game Theory.
Define.
Why is this relevant?
Moves and countermoves.
I believe they have an AI that basically has mapped every possible outcome. It's not so much that they know exactly whats going to happen 100 percent. Its that they know they have option A or B to chose from… and option A leads you to options C or D, and option B leads you to options E or F… So they have a map of all possible outcomes, and base their moves off their enemies moves