» ASP Competition | |
|
Sudoku PuzzleProblem descriptionGiven an NxN grid board (N=9 or 25), where N is a square number N=M2, fill it with integers from 1 to N so that each row, each column, and each of the N MxM boxes contains each of the integers from 1 to N exactly once. Suppose the rows are numbered 1 to N from left to right, and the columns are numbered 1 to N from top to bottom. The boxes are formed by dividing the rows from top to bottom every M rows a time and dividing the columns from left to right every M columns a time. Input formatThe input file contains the following:a. The atom size(N) that states the size of the board. N is a square number. b. The predicate square/3 that gives pre-filled squares: square(R1,C1,I1). square(R2,C2,I2). ... where each atom square(Ri,Ci,Ii) states that the square at row Ri and column Ci is filled with integer Ii. Output formatThe output gives a solution as a predicate sol/3:sol(1,1,I11). sol(1,2,I12). ... sol(1,N,IiN). where the atom sol(R,C,I) means that the integer placed at (R,C) is I. Sample inputsize(9). Sample outputsol(1,1,3). sol(1,2,8). sol(1,3,2). sol(1,4,4). sol(1,5,6). sol(1,6,9). sol(1,7,7). sol(1,8,5). sol(1,9,1). sol(2,1,1). sol(2,2,6). sol(2,3,9). sol(2,4,7). sol(2,5,3). sol(2,6,5). sol(2,7,2). sol(2,8,4). sol(2,9,8). sol(3,1,4). sol(3,2,5). sol(3,3,7). sol(3,4,8). sol(3,5,1). sol(3,6,2). sol(3,7,3). sol(3,8,6). sol(3,9,9). sol(4,1,6). sol(4,2,3). sol(4,3,5). sol(4,4,1). sol(4,5,7). sol(4,6,8). sol(4,7,9). sol(4,8,2). sol(4,9,4). sol(5,1,2). sol(5,2,9). sol(5,3,8). sol(5,4,3). sol(5,5,5). sol(5,6,4). sol(5,7,1). sol(5,8,7). sol(5,9,6). sol(6,1,7). sol(6,2,1). sol(6,3,4). sol(6,4,2). sol(6,5,9). sol(6,6,6). sol(6,7,8). sol(6,8,3). sol(6,9,5). sol(7,1,8). sol(7,2,7). sol(7,3,6). sol(7,4,5). sol(7,5,2). sol(7,6,1). sol(7,7,4). sol(7,8,9). sol(7,9,3). sol(8,1,5). sol(8,2,2). sol(8,3,1). sol(8,4,9). sol(8,5,4). sol(8,6,3). sol(8,7,6). sol(8,8,8). sol(8,9,7). sol(9,1,9). sol(9,2,4). sol(9,3,3). sol(9,4,6). sol(9,5,8). sol(9,6,7). sol(9,7,5). sol(9,8,1). sol(9,9,2). Authors: Neng-Fa Zhou |