summaryrefslogtreecommitdiff
path: root/prolog/problems/denotational_semantics/prog_8puzzle_3/en.py
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-05-22 17:48:30 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-05-22 17:48:30 +0200
commitbbcb29a202436fc0e222e187f1fadf0b1f305465 (patch)
treefed504361df37c4ce01b5b13c1082d5f3234de79 /prolog/problems/denotational_semantics/prog_8puzzle_3/en.py
parent4973979e40dfdc26dafe1cdeddf8e0bce859ba5d (diff)
Prolog: update denotational_semantics problems
Diffstat (limited to 'prolog/problems/denotational_semantics/prog_8puzzle_3/en.py')
-rw-r--r--prolog/problems/denotational_semantics/prog_8puzzle_3/en.py31
1 files changed, 26 insertions, 5 deletions
diff --git a/prolog/problems/denotational_semantics/prog_8puzzle_3/en.py b/prolog/problems/denotational_semantics/prog_8puzzle_3/en.py
index 51aa81a..7a94c74 100644
--- a/prolog/problems/denotational_semantics/prog_8puzzle_3/en.py
+++ b/prolog/problems/denotational_semantics/prog_8puzzle_3/en.py
@@ -2,17 +2,38 @@ name = 'prog_8puzzle/3'
slug = '8-puzzle-solving language with semantics'
description = '''\
-<p>Write a DCG for solving 8-puzzles. The syntax for this language should be the same as in the previous exercise: the first symbol in every word is <code>[begin]</code>, followed by any sequence of "instruction" symbols from the set {<code>left</code>, <code>right</code>, <code>up</code>, <code>down</code>}, and finally <code>[end]</code>. The starting symbol should be named <code>prog_8puzzle</code>.</p>
+<p>
+Write a DCG for solving 8-puzzles. The syntax for this language should be the
+same as in the previous exercise: the first symbol in every word is
+<code>[begin]</code>, followed by any sequence of "instruction" symbols from
+the set {<code>left</code>, <code>right</code>, <code>up</code>,
+<code>down</code>}, and finally <code>[end]</code>. The starting symbol should
+be named <code>prog_8puzzle</code>.
+</p>
-<p>The meaning of a word (program) in this language has the form <code>In-->Out</code>, mapping from input to output states. Each state is a (permuted) list of numbers from 0 to 8, where 0 stands for the empty square and other numbers for the corresponding tiles. The first three numbers in the list correspond to the top row of the 8-puzzle, the next three numbers to the middle row, and the last three numbers to the last row. The meaning of instructions <code>left</code>, <code>right</code>, <code>up</code> and <code>down</code> is to move the blank tile in the given direction.</p>
+<p>
+The meaning of a word (program) in this language has the form
+<code>In-->Out</code>, mapping from input to output states. Each state is a
+(permuted) list of numbers from 0 to 8, where 0 stands for the empty square and
+other numbers for the corresponding tiles. The first three numbers in the list
+correspond to the top row of the 8-puzzle, the next three numbers to the middle
+row, and the last three numbers to the last row. The meaning of instructions
+<code>left</code>, <code>right</code>, <code>up</code> and <code>down</code> is
+to move the blank tile in the given direction.
+</p>
<pre>
?- prog_8puzzle([0,1,2,3,4,5,6,7,8]-->Out, [begin,down,right,end], []).
Out = [3,1,2,4,0,5,6,7,8].
</pre>
-<p>Helper predicates (already defined):<br />
-&nbsp;&nbsp;<code>findblank(List,I)</code> returns the 1-based index <code>I</code> of the element 0 in <code>List</code><br />
-&nbsp;&nbsp;<code>swap(List,I,J,NewList)</code> creates <code>NewList</code> by swapping elements <code>I</code> and <code>J</code> in <code>List</code></p>'''
+<p>
+Helper predicates (already defined):
+</p>
+<ul>
+<li><code>findblank(List,I)</code> returns the 1-based index <code>I</code> of the element 0 in <code>List</code></li>
+<li><code>swap(List,I,J,NewList)</code> creates <code>NewList</code> by swapping elements <code>I</code> and <code>J</code> in <code>List</code></li>
+</ul>
+'''
hint = {}