Structured lighting basic principles for depth mapping
how, in the most simple-to-implement basic principle, does the light projection to depth map technique described here https://www.lightform.com/how-it-works actually functions?Is it some kind of an average based on the color of x pixel over all the patterns or what?

No it is not that simple , more details on that are described in https://kevinkarsch.com/publications/sa11-lowres.pdf 

P.S the author of this paper went on to become CTO of lightform.

Is it some kind of an average based on the color of x pixel over all the patterns or what? How difficult would it be to code something that could do this, up?

As mentioned above it is not simple average based on color , coding would be a tough task , you could implement model if you are capable enough to code a ray-tracer from scratch. But replicating the exact results would require a lot of low-level knowledge and certain domain expertise as not much of the implementation details and hyperparameters are described.