package solver

import (
	"time"
)

// Find all possible blocks that can be used to find a solution.
func (solver *Solver) PopulateBlocks() {

	defer solver.timeTrack(time.Now(), "Done!")
	solver.Outp.Printf("Populating blocks... ")

	solver.findBlocks(&solver.Controller.Row1, &solver.row1s)
	solver.findBlocks(&solver.Controller.Row2, &solver.row2s)
	solver.findBlocks(&solver.Controller.Row3, &solver.row3s)
	solver.findBlocks(&solver.Controller.Row4, &solver.row4s)
	solver.findBlocks(&solver.Controller.Row5, &solver.row5s)
	solver.findBlocks(&solver.Controller.Row6, &solver.row6s)
	solver.findBlocks(&solver.Controller.Row7, &solver.row7s)
	solver.findBlocks(&solver.Controller.Row8, &solver.row8s)
	solver.findBlocks(&solver.Controller.Row9, &solver.row9s)

	// This calculates and stores the total number of solutions to validate.
	solver.Iter = uint64(len(solver.row1s)) * uint64(len(solver.row2s)) * uint64(len(solver.row3s)) * uint64(len(solver.row4s)) * uint64(len(solver.row5s)) * uint64(len(solver.row6s)) * uint64(len(solver.row7s)) * uint64(len(solver.row8s)) * uint64(len(solver.row9s))

}
