Added algorithms for testing win