All pastes #346196 Raw Edit

arthur

public cpp v1 · immutable
·published 2007-02-09 03:59 UTC
rendered paste body
#include "Sudoku.h"using namespace std;Sudoku::Sudoku( int n ){	vector<int> temp;	for( unsigned int i=0; i<n*n; i++ )	{		temp.push_back(0);	}	for( unsigned int i=0; i<n*n; i++ )	{		game.push_back( temp );	}}Sudoku::Sudoku( Sudoku const& other ){	game = other.get_game();}void Sudoku::assign( int row, int col, int number ){	game[row][col] = number;}int Sudoku::n() const{	return n;}int Sudoku::n_squared() const{	return n*n;}void Sudoku::unassign( int row, int col ){	game[row][col] = 0;}bool Sudoku::is_assigned( int row, int col ) const{	if( (game[row][col] != 0) && (row >= 0) && (row < n*n) && (col >= 0) && (col < n*n) )	{ 		return true;	} else	{		return false;	}}bool Sudoku::get_number( int row, int col, int & number ) const{	if( (game[row][col] != 0) && (row >= 0) && (row < n*n) && (col >= 0) && (col < n*n) )	{		return true;	} else	{		return false;	}}//make 3 functions. one to check if in row, one for column, and one for if a number is in the boxbool Sudoku::valid_assignment( int row, int col, int number ) const{	return false;}void Sudoku::possible_numbers( int row, int col, vector<int> & numbers ) const{	if( (row < 0) && (row >= n*n) && (col < 0) && (col >= n*n) )	{		for( unsigned int i=0; i<numbers.size(); i++ )		{			numbers.clear();		} 	} else	{		for( unsigned int i=0; i<n*n; i++ )		{			numbers.clear();		}	}}bool Sudoku::is_grid_valid() const{	return false;}