added initial backtracking js script (derived from working C)