See this Wikipedia page for a full description of TRP.
This implementation is tested with Ginkgo/Gomega and uses the "workbench" samples from condorcet.ca to assert this project's results are identical to what that reference implementation generates (thereby also proving their reference implementation is at least as correct as this one).
This implementation was not based on any other code reference: just the Wikipedia article and the outputs from condorcet.ca's Java Swing-based vote counter desktop app (no code was found for it).