calculates energy, but no check for repetition + quite inefficient right now (lots of if/else)