#ifndef SUDOKU_H_
#define SUDOKU_H_

#include <string.h>

const char EMPTY = 0;
const int LENGTH = 9;
const int SQUARE = LENGTH * LENGTH;

class Sudoku {
public:
  Sudoku() { memset(square,EMPTY,SQUARE); }

  bool check(int x, int y, char number) const;
  bool nextfree(int& x, int& y);

  char at(int x, int y) const { return square[y*LENGTH+x]; }
  char& at(int x,int y) { return square[y*LENGTH+x]; }

  void print();
  void read(const char* fname);
  void write(const char* fname);

private:

  char square[SQUARE];

};

#endif

