8-puzzle - Functions not working correctly

You still haven't fixed the out-of-bounds array accesses.

I guess that part was accidentally right anyway.

Luck-based and stochastic programming techniques were debunked decades ago.