1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lyrx [107]
2 years ago
14

Using above information, Write a prolog program to answer the following queries. Please note that you cannot simply answer these

queries with only facts, you should answer then using facts and rules
Computers and Technology
1 answer:
vampirchik [111]2 years ago
7 0

Using the computational knowledge in python it is possible to write a code that uses the functions to make a  a prolog program to answer the following queries

<h3>Writting the code in python:</h3>

<em>valid([]).</em>

<em>valid([Head|Tail]) :-</em>

<em>fd_all_different(Head),</em>

<em>valid(Tail).</em>

<em />

<em>sudoku(Puzzle, Solution) :-</em>

<em>Solution = Puzzle,</em>

<em>Puzzle = [S11, S12, S13, S14,</em>

<em>S21, S22, S23, S24,</em>

<em>S31, S32, S33, S34,</em>

<em>S41, S42, S43, S44],</em>

<em />

<em>fd_domain(Solution, 1, 4),</em>

<em />

<em>Row1 = [S11, S12, S13, S14],</em>

<em>Row2 = [S21, S22, S23, S24],</em>

<em>Row3 = [S31, S32, S33, S34],</em>

<em>Row4 = [S41, S42, S43, S44],</em>

<em />

<em>Col1 = [S11, S21, S31, S41],</em>

<em>Col2 = [S12, S22, S32, S42],</em>

<em>Col3 = [S13, S23, S33, S43],</em>

<em>Col4 = [S14, S24, S34, S44],</em>

<em />

<em>Square1 = [S11, S12, S21, S22],</em>

<em>Square2 = [S13, S14, S23, S24],</em>

<em>Square3 = [S31, S32, S41, S42],</em>

<em>Square4 = [S33, S34, S43, S44],</em>

<em />

<em>valid([Row1, Row2, Row3, Row4,</em>

<em>Col1, Col2, Col3, Col4,</em>

<em>Square1, Square2, Square3, Square4]).</em>

<em />

<em>| ?- sudoku([_, 4, 3, 2,</em>

<em>3, _, _, _,</em>

<em>4, 1, _, _,</em>

<em>_, _, 4, 1],</em>

<em>Solution).</em>

<em>Solution = [1,4,3,2,3,2,1,4,4,1,2,3,2,3,4,1]</em>

<em>yes</em>

See more about python at brainly.com/question/18502436

#SPJ1

You might be interested in
QUESTION 7
marishachu [46]
False, it needs to be properly cited because that is plagiarism which is illegal
6 0
3 years ago
If my 98 dodge ram 1500 truck is dropping RPM's when i stop does that mean i need new throttle body sensors or does it mean i ne
geniusboy [140]
You might need a new 02 sensor and i really dont know about the vacuum leak.
6 0
3 years ago
Read 2 more answers
Write a method named rotateright that accepts an array of integers as a parameter and rotates the values in the array to the rig
trasher [3.6K]
You should really state what language you are using. I have produced your method in C#, and should be easily translatable in to any other language.

static void RotateRight<T>(T[] arr)
{          
    T temp = arr[arr.Length - 1];
   
    for (int i = arr.Length - 1; i >= 0; i--)
    {               
        if (i == 0)                   
            arr[i] = temp;               
        else                   
            arr[i] = arr[i - 1];           
    }       
}
3 0
3 years ago
When an input file is opened, the read position is initially set to the first item in the file. question 13 options:
Rom4ik [11]
<span>A special value inside of an INPUT file that marks the position of the location of the next item that will be read from the file. When opened, the READ POSITION is initially set to the first item in the file, thus the Answer is True.</span>
4 0
3 years ago
Which website can help you find antivirus software?
sdas [7]
McAfee!!! you should get it
3 0
4 years ago
Read 2 more answers
Other questions:
  • What feature is required to send data from a web-connected device (like a point-of-sale system) to Google Analytics?
    14·1 answer
  • A. True <br> b. False: variables represent storage locations in the computer's memory.
    13·1 answer
  • A restaurant has a case type that allows customer to book the dining room for events. Customers provide basic information includ
    11·1 answer
  • Alessandro wants to use his desktop computer to video chat with his mother. What hardware does he need to accomplish this?
    9·1 answer
  • Write the definition of a function named count that reads all the strings remaining to be read in standard input and returns the
    13·1 answer
  • Which option identifies the type of engineers described in the following scenario?
    6·1 answer
  • 49 points!
    14·1 answer
  • A classic game, Wario Land, has an invincible main character who reacts to the environment in order to solve puzzles. So, for ex
    11·1 answer
  • Type the correct answer in the box. Spell all words correctly. Which language should you use to add functionality to web pages?
    5·1 answer
  • the set of methods that can be used to acquire, organize, store, manipulate, and transmit information is known as .
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!