Add validity check before printing board