constraintSudokuTest.frink

Download or view constraintSudokuTest.frink in plain text format


/** This is a tester for Frink's constraint solver to solve a Sudoku problem.
    See constraintSudoku.frink for the main solver.
*/

use constraintSudoku.frink

// Fiendish!
c=["--9-3--7-",
   "7--45-6--",
   "-5------1",
   "-------5-",
   "96--4--23",
   "-8-------",
   "6------3-",
   "--5-16--9",
   "-7--2-8--"]
Sudoku.solveFromArray[c]

c=["----19-4-",
   "--48--6--",
   "75------2",
   "-9-1-2--4",
   "-----3---",
   "5--4-6-3-",
   "8------73",
   "--6--84--",
   "-1-29----"]
Sudoku.solveFromArray[c]

// Super Fiendish!
c=["-42---8--",
   "3----5---",
   "---3-91--",
   "-29-----4",
   "--7---5--",
   "4-----37-",
   "--47-3---",
   "---5----6",
   "--5---42-"]
Sudoku.solveFromArray[c]

// World's hardest?
// https://www.kristanix.com/sudokuepic/worlds-hardest-sudoku.php
c=["1----7-9-",
   "-3--2---8",
   "--96--5--",
   "--53--9--",
   "-1--8---2",
   "6----4---",
   "3------1-",
   "-4------7",
   "--7---3--"]
Sudoku.solveFromArray[c]

// Another hardest ever:
// https://abcnews.go.com/blogs/headlines/2012/06/can-you-solve-the-hardest-ever-sudoku
c=["8--------",
   "--36-----",
   "-7--9-2--",
   "-5---7---",
   "----457--",
   "---1---3-",
   "--1----68",
   "--85---1-",
   "-9----4--"]
Sudoku.solveFromArray[c]


Download or view constraintSudokuTest.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20145 days, 6 hours, 1 minutes ago.