The PyMCR library helps with scoring of a Mahjong hand given a situation, using Mahjong Competition Rules (also known as Chinese Official).
Except for being useful in Mahjong related software, it is also a reference implementation clarifying the official rule books.
The library is capable of identify how to obtain the highest possible score in a given situation. It does not handle penalties, but all 81 scoring elements are handled.
The project has been around for over 10 years, but have spent most of this time sleeping. It still needs input to sort out bugs and misunderstandings of the rules.
Try it out at it http://mahjonghand.appspot.com. The Google App Engine Application shown there is included in the project.
The project started in 2008, and then after a nearly 4 year break, some the issues people had reported were corrected in version 1.1. Now over 11 years later I ve started to clean up the project again.