Memory Game

```javascript
memory.game_board.determine_row_size = function() {

        //GET SQUARE ROOT OF TOTAL CARDS
        var square_root = Math.sqrt( memory.cards.total_cards );

        //IF SQUARE ROOT IS 8 OR LESS AND AN INTEGER CREATE A SQUARE LAYOUT
        if ( square_root <= 8 && square_root % 1 === 0 ) {
            return square_root;
        }

        //ELSE CREATE A RECTANGLE LAYOUT WITH A MAXIMUM OF 8 TILES TO A ROW
        else {
            for (var i=8; i>=2; i--) {
                if ( memory.cards.total_cards % i === 0) {
                    return i;
                    break;
                }
            }
        }
    };
```