1. Init board size to 4 instead of 5
2. Optimize by avoiding multiple loops.