Random Event Unknown to Certain Players?

I am trying to simulate the US breaking the Japanese naval code. I want this to be random so that the Japanese player does not know the code has been broken. When it is broken, the US player should be able to see the Japanese player’s ships.

I would love to use George’s hidden unit code but I am no programmer and can’t figure out how to make it work.

Instead, I was thinking of using a black tile on top of the stack to hide whats underneath from the other players. When the code is broken the US player would be allowed to look under these tiles and thus see where the ships are.

How would I do this?

Or, is there a better way to simulate what I am trying to do?

Better yet, is anyone willing to help me get George’s hidden unit files working?

I appreciate any and all assistance,

thank you