Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
818 B
2
Indexable
Never
```
function CheckGrid(puzzle) {
    var stack = [];
    let k = 1;

    for (i = 0; i < 3; i++) {
        for (j = 0; j < 3; j++) {
    
            stack.push(puzzle[i][j]);
            stack.push(puzzle[i][j + 1]);
            stack.push(puzzle[i + 1][j]);
            stack.push(puzzle[i + 1][j + 1]);
            console.log("This stack should not be empty : ", stack);
            for (k = 1; k <= 4; k++) {
                console.log("check the k values : ", k)
                if (SearchStack(stack, k) === false) {
                    return console.log('false')
                } else {
                    SearchStack(stack, k);
                }
            }
            stack = [];
            console.log("This stack must be empty : ", stack)
        }
    }
    return console.log('true')
}
       ```