implemented energy calculation
verified input 3x7.png returns correct SPT