This study proposes a novel flocking algorithm for underwater robotics based on the collective behaviors of schooling fish. The algorithm, Fish-Inspired Robotic Algorithm (FIRA), integrates standard flocking behaviors such as Attraction, Alignment, and Repulsion, as well as predator avoidance, foraging, general obstacle avoidance, and wandering. Compared with traditional flocking algorithms, FIRA includes predictive elements to counteract processing delays from sensors and prioritizes the highest cluster of agents on a single side, leading to superior performance in collision avoidance, exploration, foraging, and the emergence of realistic behaviors. To address the challenges of underwater communication, FIRA is designed to work with high-latency, non-guaranteed communication methodology based on stigmergy methods found in nature, enabling practical, multi-agent, inexpensive, and tetherless communication. FIRA aims to provide a computational light control algorithm designed to work with low-cost, low-computing agents to further research using robotics to assimilate into a school of biological fish. To demonstrate the effectiveness of FIRA, it was simulated within Unity using a digital twin of a bio-inspired robotic fish, which incorporates the robot's motion and sensors in a realistic, real-time environment, with the algorithm used to direct the movements of individual agents. The performance of FIRA was compared against other collective motion algorithms to determine its effectiveness as a flocking algorithm. From the experiments, FIRA outperformed the other algorithms in both collision avoidance and exploration. These experiments establish FIRA as a viable flocking algorithm to mimic fish behavior in robotics.