Source code for pattern recognition and material transfer