readSudoku: Read a File Containing a Sudoku Grid

View source: R/readSudoku.R

readSudokuR Documentation

Read a File Containing a Sudoku Grid

Description

Reads a file containing a Sudoku grid (a 9x9 matrix).

Usage

  readSudoku(fn, map)

Arguments

fn

A filename.

map

Vector of unique puzzle elements (possibly longer than necessary). The default is c(1:9, letters), so an N=16 puzzle should be encoded using '1'-'9' and 'a'-'g'.

Details

The input file should look like this:

-6-1-4-5-
--83-56--
2-------1
8--4-7--6
--6---3--
7--9-1--4
5-------2
--72-69--
-4-5-8-7-

Blank cells can be indicated with any character not in "map", such as the '-' used here.

Value

A numeric matrix (usually 9x9).

Author(s)

David E. Brahm <brahm@alum.mit.edu>

Examples

  z <- readSudoku(system.file("puz1.txt", package="sudoku"))

sudoku documentation built on April 19, 2022, 5:09 p.m.

Related to readSudoku in sudoku...