Fix bench/sudoku, broken by deëxporting

This commit is contained in:
Ben Striegel 2013-01-31 00:06:48 -05:00
parent b5f61fddde
commit 9330b2f7b9

View File

@ -29,16 +29,14 @@ use io::{ReaderUtil, WriterUtil};
// If called without arguments, sudoku solves a built-in example sudoku
//
export grid_t, read_grid, solve_grid, write_grid;
// internal type of sudoku grids
type grid = ~[~[u8]];
// exported type of sudoku grids
enum grid_t { grid_ctor(grid), }
pub enum grid_t { grid_ctor(grid), }
// read a sudoku problem from file f
fn read_grid(f: io::Reader) -> grid_t {
pub fn read_grid(f: io::Reader) -> grid_t {
assert f.read_line() == ~"9,9"; /* assert first line is exactly "9,9" */
let mut g = vec::from_fn(10u, {|_i|
@ -56,7 +54,7 @@ fn read_grid(f: io::Reader) -> grid_t {
}
// solve sudoku grid
fn solve_grid(g: grid_t) {
pub fn solve_grid(g: grid_t) {
fn next_color(mut g: grid, row: u8, col: u8, start_color: u8) -> bool {
if start_color < 10u8 {
// colors not yet used
@ -126,7 +124,7 @@ fn solve_grid(g: grid_t) {
}
}
fn write_grid(f: io::Writer, g: grid_t) {
pub fn write_grid(f: io::Writer, g: grid_t) {
for u8::range(0u8, 9u8) |row| {
f.write_str(fmt!("%u", (*g)[row][0] as uint));
for u8::range(1u8, 9u8) |col| {