It works, but the algorithm is overly complicated — I didn’t
know about Hirzebruch’s generating function when I wrote it. The
generating function is given succinctly in this
note by Donu
Arapura; he’s implemented it in
Sage and
Maple.
I’ve implemented it in
Macaulay2, if you prefer that.