Similarly to FishPlaysPokemon, I have virtually segmented my fish tank into 9 parts (3 by 3).
Depending on which part of the tank a fish is in, it will send a different key press to the game. Aquarius sends key presses for Player 1, and Robert the Bruce sends key presses for Player 2.
As for the actual code used for color detection and key sending, I do all of it using AutoIt and some shoddy code I cooked up over the course of a few days.
Points of Interest:
There is a tiny delay between one player pressing their key and the other one. To compensate, a player is chosen at random each loop to be the first to press their key, so it balances out.
A fish can send multiple key presses at the same time if it is in multiple screen regions when the check is made.
Movement with the up/down/left/right arrows is evaluated first, and then the other key presses are sent. This allows for more combos to potentially happen (direction press + punch to throw).
Key presses in menus are handled slightly differently to ensure that the game continues smoothly.