I've been playing a lot of Galaga lately on a Namco Revision B board, and I'm running into an interesting game detail that has probably been documented or examined by others or could be divined by looking at machine code.
The game has, superficially, three stages that cycle endlessly with edge cases for stage 0, 1, and 2. The enemies always fly in those patterns onto the screen and the player can predict which pattern will be used based on the stage number. It's trivial to visually confirm the three types of flight paths.
But there's some nuance there that I've yet to see documented and is less trivial to determine. Within those entrance patterns some of the ships choose to dive-bomb the player's ship and some of them choose to fire at the player, and which ships decide to do which behavior doesn't seem to follow the clear three stage loop. And after the enemies assemble at the top of the screen, one of them that isn't a commander can be randomly chosen to be promoted into a specialized ship that also cycles after every bonus stage. And, of course, shortly after assembly the enemies attack from the top of the screen in a rapid single-file order.
My question is, is any of this random? And if it's not, is the logic available anywhere for examination? For example, given a specific stage number, could one predict which enemies would choose to dive-bomb and which would choose to fire? And given an arbitrary stage number and starting enemy formation, could one predict who would attack and in what order?