Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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:
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),
.
.
.
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,
now I don't know how to give some values and get answer...
I'm just a beginner.
for example solve this sample
47--6--59
---2-7---
6-------8
--5-8-9--
-1-7-6-8-
-—8-4-2--
8-------2
---6-3---
92--5--16
Posted 31-Jan-12 7:38am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 245
1 Jochen Arndt 155
2 PIEBALDconsult 150
3 Afzaal Ahmad Zeeshan 120
4 DamithSL 115
0 OriginalGriff 5,695
1 DamithSL 4,591
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 31 Jan 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100