The reason why it was unbeatable was because in the detection code the blue it was detecting was different from the shade of blue actually in the game. I fixed that, and now it's significantly less unbeatable.