+ new_mini_grid.squares[i].glyph = is_glyph;
+ }
+
+ /* If this is the last cell of played in a mini-grid then it's
+ * time to score it. */
+ const occupied = new_mini_grid.squares.reduce(
+ (acc, val) => acc + (val.symbol !== null ? 1 : 0), 0);
+ if (occupied === 9) {
+ for (let i = 0; i < 9; i++) {
+ if (new_mini_grid.squares[i].glyph) {
+ if (new_mini_grid.squares[i].symbol === '+')
+ new_mini_grid.score_plus++;
+ else
+ new_mini_grid.score_o++;
+ }
+ }
+ if (new_mini_grid.score_plus > new_mini_grid.score_o)
+ new_mini_grid.winner = '+';
+ else
+ new_mini_grid.winner = 'o';