R/update_cells.R

Defines functions update_cells

update_cells <- function(board, cell, m, to_hide = FALSE) {
  where <- which(m, arr.ind = TRUE)
  for(r in seq_len(nrow(where))) {
    draw_cell(cell, where[[r, "row"]], where[[r, "col"]])
  }
  if(to_hide) attr(board, "hide") <- m
  board[m] <- cell
  board
}

Try the minesweeper package in your browser

Any scripts or data that you put into this service are public.

minesweeper documentation built on April 3, 2025, 9:29 p.m.