shotokanpoloto
Programmer
I've written a code for solving sudoku.Now I don't know how to enter values of my variables.
Here is a part of my code:
<pre lang="text">
number(1).
number(2).
number(3).
number(4).
number(5).
number(6).
number(7).
number(8).
number(9).
sudoku(A1,A2,A3,A4,A5,A6,A7,A8,A9,B1,B2,B3,B4,B5,B6,B7,B8,B9,C1,C2,C3,C4,C5,C6,C7,C8,C9,D1,D2,D3,D4,D5,D6,D7,D8,D9,E1,E2,E3,E4,E5,E6,E7,E8,E9,F1,F2,F3,F4,F5,F6,F7,F8,F9,G1,G2,G3,G4,G5,G6,G7,G8,G9,H1,H2,H3,H4,H5,H6,H7,H8,H9,I1,I2,I3,I4,I5,I6,I7,I8,I9) :-
number(A1),
number(A2),
number(A3),
number(A4),
number(A5),
number(A6),
number(A7),
number(A8),
number(A9),
</pre>
.
.
.
<pre lang="text">
H7 \= G7, H7 \= G8, H7 \= G9,
H7 \= H8, H7 \= H9,
H7 \= I7, H7 \= I8, H7 \= I9,
H8 \= G7, H8 \= G8,H8 \= G9,
H8 \= H7, H8 \= H9,
H8 \= I7, H8 \= I8, H8 \= I9,
H9 \= G7, H9 \= G8,H9 \= G9,H9 \= H7,H9 \= H8,
H9 \= I7,H9 \= I8,H9 \= I9,
I7 \= G7, I7 \= G8, I7 \= G9, I7 \= H7,
I7 \= H8, I7 \= H9,
I7 \= I8, I7 \= I9,
I8 \= G7, I8 \= G8,I8 \= G9,
I8 \= H7, I8 \= H8,I8 \= H9,
I8 \= I7, I8 \= I9,
I9 \= G7, I9 \= G8,I9 \= G9,I9 \= H7,I9 \= H8,
I9 \= I7,I9 \= I8,
</pre>
now I don't know how to give some values and get answer...
I'm just a beginner.
for example solve this sample
<pre lang="vb">47--6--59
---2-7---
6-------8
--5-8-9--
-1-7-6-8-
-—8-4-2--
8-------2
---6-3---
92--5--16</pre>
Here is a part of my code:
<pre lang="text">
number(1).
number(2).
number(3).
number(4).
number(5).
number(6).
number(7).
number(8).
number(9).
sudoku(A1,A2,A3,A4,A5,A6,A7,A8,A9,B1,B2,B3,B4,B5,B6,B7,B8,B9,C1,C2,C3,C4,C5,C6,C7,C8,C9,D1,D2,D3,D4,D5,D6,D7,D8,D9,E1,E2,E3,E4,E5,E6,E7,E8,E9,F1,F2,F3,F4,F5,F6,F7,F8,F9,G1,G2,G3,G4,G5,G6,G7,G8,G9,H1,H2,H3,H4,H5,H6,H7,H8,H9,I1,I2,I3,I4,I5,I6,I7,I8,I9) :-
number(A1),
number(A2),
number(A3),
number(A4),
number(A5),
number(A6),
number(A7),
number(A8),
number(A9),
</pre>
.
.
.
<pre lang="text">
H7 \= G7, H7 \= G8, H7 \= G9,
H7 \= H8, H7 \= H9,
H7 \= I7, H7 \= I8, H7 \= I9,
H8 \= G7, H8 \= G8,H8 \= G9,
H8 \= H7, H8 \= H9,
H8 \= I7, H8 \= I8, H8 \= I9,
H9 \= G7, H9 \= G8,H9 \= G9,H9 \= H7,H9 \= H8,
H9 \= I7,H9 \= I8,H9 \= I9,
I7 \= G7, I7 \= G8, I7 \= G9, I7 \= H7,
I7 \= H8, I7 \= H9,
I7 \= I8, I7 \= I9,
I8 \= G7, I8 \= G8,I8 \= G9,
I8 \= H7, I8 \= H8,I8 \= H9,
I8 \= I7, I8 \= I9,
I9 \= G7, I9 \= G8,I9 \= G9,I9 \= H7,I9 \= H8,
I9 \= I7,I9 \= I8,
</pre>
now I don't know how to give some values and get answer...
I'm just a beginner.
for example solve this sample
<pre lang="vb">47--6--59
---2-7---
6-------8
--5-8-9--
-1-7-6-8-
-—8-4-2--
8-------2
---6-3---
92--5--16</pre>