summaryrefslogtreecommitdiff
path: root/prolog/problems/license_plates/joindigits_2
diff options
context:
space:
mode:
authorAleš Smodiš <aless@guru.si>2015-08-18 16:06:19 +0200
committerAleš Smodiš <aless@guru.si>2015-08-18 16:06:19 +0200
commit95e2fe57f6e4639f6ae9f1fef368829d5090dbf6 (patch)
tree462ba05eb0c4732ca1c97739548801258bf47b40 /prolog/problems/license_plates/joindigits_2
Exported all problems from the SQLite database into the new directory structure.
Diffstat (limited to 'prolog/problems/license_plates/joindigits_2')
-rw-r--r--prolog/problems/license_plates/joindigits_2/common.py14
-rw-r--r--prolog/problems/license_plates/joindigits_2/en.py15
2 files changed, 29 insertions, 0 deletions
diff --git a/prolog/problems/license_plates/joindigits_2/common.py b/prolog/problems/license_plates/joindigits_2/common.py
new file mode 100644
index 0000000..dc3e4a5
--- /dev/null
+++ b/prolog/problems/license_plates/joindigits_2/common.py
@@ -0,0 +1,14 @@
+id = 145
+group = 'license_plates'
+number = 52
+visible = True
+facts = None
+
+solution = '''\
+joindigits([X], [X]).
+joindigits([X,Y|T], NT) :-
+ XY is 10*X + Y,
+ joindigits([XY|T], NT).
+joindigits([X,Y|T], [X|NT]) :-
+ joindigits([Y|T], NT).
+'''
diff --git a/prolog/problems/license_plates/joindigits_2/en.py b/prolog/problems/license_plates/joindigits_2/en.py
new file mode 100644
index 0000000..19623d7
--- /dev/null
+++ b/prolog/problems/license_plates/joindigits_2/en.py
@@ -0,0 +1,15 @@
+id = 145
+name = 'joindigits/2'
+slug = 'join adjacent numbers in a list'
+
+description = '''\
+<p><code>joindigits(L, NL)</code>: the list <code>NL</code> is obtained from <code>L</code> by arbitrarily joining neighboring digits. Your code should generate all valid solutions.</p>
+<pre>
+ ?- joindigits([3,2,4], NL).
+ NL = [324] ;
+ NL = [32,4] ;
+ NL = [3,24] ;
+ NL = [3,2,4].
+</pre>'''
+
+hint = {}