Skip to content

Commit

Permalink
Improve puzzle docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Carleslc committed Feb 14, 2022
1 parent af94140 commit dab9d1d
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 19 deletions.
24 changes: 16 additions & 8 deletions Layton/Curious Village/128-curious-lock.pro
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
% Professor Layton: Curious Village (Puzzle 128)
% https://layton.fandom.com/wiki/Puzzle:Number_Lock

% Solve the following lock:
%
% A E
% B D F
% C G
%
% Where A * B * C = E * F * G = B * D * F
% With different digits from 1 to 9
/**
The door in front of you has an odd lock mounted on the front.
The only way to unlock this strange contraption is to place small tiles labeled from one to nine in its slots.
The lock will open when the numbers on the lock equal the same number when multiplied vertically and horizontally.
There are nine tiles, but the lock only has seven slots, so you won't need two tiles.
Can you open the lock?
A E
B D F
C G
A * B * C = E * F * G = B * D * F
*/

:- use_module(library(clpfd)).

Expand Down
24 changes: 16 additions & 8 deletions Layton/Curious Village/128-curious-lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@
# -*- coding: utf-8 -*-

# Professor Layton: Curious Village (Puzzle 128)
# https://layton.fandom.com/wiki/Puzzle:Number_Lock

# Solve the following lock:
#
# A E
# B D F
# C G
#
# Where A * B * C = E * F * G = B * D * F
# With different digits from 1 to 9
"""
The door in front of you has an odd lock mounted on the front.
The only way to unlock this strange contraption is to place small tiles labeled from one to nine in its slots.
The lock will open when the numbers on the lock equal the same number when multiplied vertically and horizontally.
There are nine tiles, but the lock only has seven slots, so you won't need two tiles.
Can you open the lock?
A E
B D F
C G
A * B * C = E * F * G = B * D * F
"""

from itertools import permutations

Expand Down
13 changes: 13 additions & 0 deletions Layton/Diabolical Box/145-pearls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
# -*- coding: utf-8 -*-

# Professor Layton: Diabolical Box (Puzzle 145)
# https://layton.fandom.com/wiki/Puzzle:500_Pearls

"""
A wizard sets a traveller a strange task.
"There are 500 pearls in that cave.
I want you to go and bring a certain number of pearls to me.
This number allows you to divide the pearls into groups of 2, 3, 4, 5, 6 or 7 and always have one pearl left over.
Bring me this number of pearls and you can keep them all for yourself!"
The traveller tries his best, but the number of pearls he bring back doesn't leave one pearl over when divided into groups of 4.
How many pearls did he bring to the wizard?
"""

import argparse

Expand Down
8 changes: 7 additions & 1 deletion Layton/Diabolical Box/148-eight-cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
# -*- coding: utf-8 -*-

# Professor Layton: Diabolical Box (Puzzle 148)
# https://layton.fandom.com/wiki/Puzzle:Eight_Cards

# What are the valid products including all digits from 1 to 8 in the form ABC x D = EFGH ?
"""
These cards, numbered 1 to 8, can be used to make two multiplication equations.
One is given here (453 x 6 = 2718), but can you work out the second one?
What are the valid products including all digits from 1 to 8 in the form ABC x D = EFGH ?
"""

from itertools import permutations

Expand Down
4 changes: 2 additions & 2 deletions Prolog/farmer.pro
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
% https://www.metalevel.at/prolog/optimization
%
% A chicken farmer also has some cows for a total of 30 animals,
% and the animals have 74 legs in all.
%
% How many chickens does the farmer have?
%
% https://www.metalevel.at/prolog/optimization

:- use_module(library(clpfd)).

Expand Down

0 comments on commit dab9d1d

Please sign in to comment.