package solver

// The actual function that finds the blocks matching the partial blocks.
func (solver *Solver) findBlocks(row *string, rows *[]string) {
	// Declare selection
	var selection []string
	var currBlocks []string
	funcRow := *row

	for letter := range funcRow {

		if len(selection) == 0 {
			currBlocks = solver.Controller.Blocks
		} else {
			currBlocks = selection
			selection = nil
		}

		for _, block := range currBlocks {

			currRow := block

			if funcRow[letter] == currRow[letter] {
				foundRow := currRow
				selection = append(selection, foundRow)
			}
			if funcRow[letter] == '0' {
				foundRow := currRow
				selection = append(selection, foundRow)
			}

		} // End for-loop

	} // End for-loop

	*rows = selection
}
