source code for rich game