public function setBoard(array $board)
    {
        if (empty($board)) {
            return false;
        }

        // is not associative array and total size of array is not the same as board size then invalidate board
        if (($boardSize = count($board, COUNT_RECURSIVE)) == count($board) && $boardSize != pow($this->size, 2)) {
            return false;
        }

        // if not associative then set the boar as one
        if (count($board, COUNT_RECURSIVE) == count($board)) {
            $this->board = array_chunk($board, $this->size);
        } else {
            $this->board = $board;
        }

        // if distinct values is greater than 2 then invalidate board
        $boardDistinctValues = array_unique(array_filter(array_reduce($this->board, 'array_merge', [])));
        if (count($boardDistinctValues) > 2) {
            return false;
        }

        return $this->board;
    }