improved performance by a bit

-moved out several dereferences in for-loops
-nextLayer could be a generator?
-lambda board, i, p: board[:i] + p + board[i + 1:] is not very fast, I don't see an alternative thoug
-moved put lambda move out of the move-function, it would be reacreated every time the function is called