Skip to content

Instantly share code, notes, and snippets.

@maxfunke
Created May 9, 2014 08:36
Show Gist options
  • Save maxfunke/cca46cfc13e0bbb829b4 to your computer and use it in GitHub Desktop.
Save maxfunke/cca46cfc13e0bbb829b4 to your computer and use it in GitHub Desktop.
basic algorithm for back tracking (pseudo-code)
boolean solve(configuration conf) {
if (no more choices)
return (conf is goal state);
for (all available choices) {
try one choice c;
ok = solve(conf with choice c made);
if (ok)
return true;
else
unmake choice c;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment