An Algorithm for Two-Player Repeated Games With Perfect Monitoring