Writing on the Wall code for algorithm