I was think yesterday, is there any way to change that `RandomChoice` for this: ` choices=Flatten@{If[ known[[i+1,j]]!=2 , up ,{}],
If[ known[[i-1,j]]!=2 , down ,{}],
If[ known[[i,j-1]]!=2 , left ,{}],
If[ known[[i,j+1]]!=2 , right ,{}]}
If[choices!={},RandomChoice[choices]]`
But instead of the `up`, `down`, `right` and `left` we change it for `{1, 0}, {0, 1}, {-1, 0}, {0, -1}`.
Maybe this would solve the problem of choosing a wall even after it have visited it before.
If[ known[[i-1,j]]!=2 , down ,{}],
If[ known[[i,j-1]]!=2 , left ,{}],
If[ known[[i,j+1]]!=2 , right ,{}]}
If[choices!={},RandomChoice[choices]]`
But instead of the `up`, `down`, `right` and `left` we change it for `{1, 0}, {0, 1}, {-1, 0}, {0, -1}`.
Maybe this would solve the problem of choosing a wall even after it have visited it before.