move some index determining code into the Board class
implement solution by logic