In effect, each puzzle piece is acting as a switch.
If you need to support more puzzle pieces than you have digital pins available then there are techniques available to combine a series resister with each switch in such a way that you can calculate which switches are open and which switches are closed, using a single analog input. These techniques do assume that the switch has negligible resistance when it is closed. The approach you're using is much simpler to use, copes with the switches not being perfect conductors and is the best way to continue as long as you can afford to use a separate digital input for each puzzle piece.