This is one of our requirements for the project which I chose to implement. For ours we have decided to have two types of fog: one which hides all traps and enemy players which can be uncovered permanently by exploring the arena, and a secondary one which only excludes the area the player's robots are currently in but shows traps if they have discovered them already. The way the area to uncover will be calculated for each robot depends on their time units/energy. If a robot has an energy of 3, a 7 by 7 square is revealed with the robot at the centre (see image below). The main fog of war is shown in this image. Now that the traps have been discovered they will no longer be hidden.
Robot movement
Alongside the fog of war, I also implemented robot movement. When a player clicks a robot, the possible positions they can move (the distance of which is determined by the energy) will display as a green square as can be seen in the image above. The movement is the same as a Queen in the game of chess. To get those positions, I implemented the code below. This is the shortest way I managed to implement it. The generateMoveSprites function determines whether or not to render the green square in that location (doesn't render if it's in a border).
Additional thoughts
We did originally want the fog of war to be its own class, however this was not possible because it depends on underlying systems and would be incredibly inefficient. Moving it would only benefit the readability of the main game scene's cpp but would be detrimental to the rest of the code base and the performance.