refactoring of solver to remove duplication between solving board and twin. added tests for the solver