Open main menu

CDOT Wiki β

Changes

Moscow 5

1,025 bytes added, 15:38, 5 October 2012
Created page with '== Assignment 1 == This is a KenKen puzzle solver using a brute force algorithm implementing recursive backtracking to solve a KenKen puzzle. The program creates a possible map …'
== Assignment 1 ==

This is a KenKen puzzle solver using a brute force algorithm implementing recursive backtracking to solve a KenKen puzzle. The program creates a possible map of solutions and sequencially substitutes possible valid inputs into the solution map accordingly. When a solution is found to be a failure the program exits the recursive loop back to the last stable solution and continues with the solution map.

<br/>

Source: [[https://github.com/thlmille/KenKenSolver KenKen Solver]]

<br/>

We will be optimizing the following functions:

<br/>

The update_possible method:
<big><pre>
// Iterate through solution we have so far, and

// remove possibilities from possible map

void puzzle::update_possible () {

for (int i = 1; i <= this->size; ++i) {

for (int j = 1; j <= this->size; ++j) {

if (this->solution[i][j] != 0) {

this->possible[make_pair(i, j)].clear();

int taken = this->solution[i][j];

update_possible_row(taken, i);

update_possible_column(taken, j);

}

}

}

}