Esempio n. 1
0
        static void Main(string[] args)
        {
            initBoard();

            //loop over the number of properties
            //every property should not be equal for all row, column and diagonal

            for (int k = 0; k < 4; k++)
            {
                GenerateRowRules(k);
                GenerateColumnRules(k);
                GenerateDiagonalRules(k);
            }

            //add the rules that not all stones should be the same
            NotAllTheSame();

            //combine all rules
            FSharpList <CNFify.Term> FSharpAllPropositions = ListModule.OfSeq(AllPropositions);

            CNFify.Term all = CNFify.createAndClauseFromList(FSharpAllPropositions);

            var dimacs = CNFify.makeDimacs(all);

            using (System.IO.StreamWriter file = new System.IO.StreamWriter("..\\..\\..\\Minisat\\input"))
            {
                file.WriteLine(dimacs);
            }
        }
Esempio n. 2
0
        private static CNFify.Term NotAllEqual(List <CNFify.Term> input)
        {
            //we now have a list of all squares that should not be equal, make a
            //not - and combi of them:

            // voor in de slides: gekut met types kan wel wat beter Microsoft
            //eerste poging ipv ListModule.OfSeq was: (Microsoft.FSharp.Collections.FSharpList<CNFify.Term>)AllAnds;

            CNFify.Term NotAllSame =
                CNFify.Term.NewNot(
                    CNFify.createAndClauseFromList(ListModule.OfSeq(input))
                    );

            return(NotAllSame);
        }