Starting from:

$35

COSC 326 Sage and Trewlawney

COSC 326 
Sage and Trewlawney
Problem Description
“You must cast your spell,” said the Sage, “at the Golden Hour.”
“But how shall I know the Golden Hour?” asked Trelawney.
The Sage rolled his eyes and quoted:
“The Golden Hour of the day is the Silver Hour with the day as bronze and
the day as copper. When copper is one, the Silver Hour is one no matter
what is bronze. When bronze and copper are the same, the Silver Hour is
one hour later than the Silver Hour with bronze the same and copper one
less. When copper is more than bronze, the Silver Hour is the Golden Hour
with bronze as the day. When bronze is more than copper, the Silver Hour
is the Silver Hour with copper the same and bronze less copper as bronze,
together with the Silver Hour with bronze the same and copper one less.”
“This I know by heart,” said Trelawney, “but there is much I do not understand. What
number is the day?”
“The day is the number of days from the start of the year,” said the Sage. “The first
of January is day one and Christmas is, therefore, 359 this year. It is 360 in a leap
year.”
“Then how,” said Trelawney, “can I take two Silver Hours together? If I add seven and
nine, for example, I get sixteen. That is not an hour.”
“No!” said the Sage. “The Golden Hour is always a number from one to twelve. Golden
spells can be cast only from one to midnight. They are never morning spells. If you
calculate a number greater than twelve, reduce it by twelve to get a valid hour.”
“I see,” said Trelawney doubtfully. “The Golden Hour of two is the Silver Hour of two
and two. This is one hour later than the Silver Hour of two and one, by the third rule,
and that is one by the second rule, so the answer is two.” He picked up his quill and
tried to think of a simpler way to write all this.
Eventually he produced the following:
COSC 326 2018 Semester 2 Étude 2
Golden (Day of 3) by Rule 1 is:
Silver (Bronze of 3, Copper of 3) by Rule 3 is:
Silver (Bronze of 3, Copper of 2) + 1 by Rule 5 is:
Silver (Bronze of 3-2, Copper of 2) +
 Silver (Bronze of 3, Copper of 1) + 1 by Rule 2 is:
Silver (Bronze of 3-2, Copper of 2) + 1 + 1 by common
 arithmetic is:
Silver (Bronze of 1, Copper of 2) + 2 by Rule 4 is:
Golden (Day of 1) + 2
“Are you sleeping?” asked the Sage.
“It’s alright,” said Trelawney. “I have calculated the Golden Hours for the first week. I
am sure I can finish before tomorrow.”
“Let us hope so,” said the Sage.
Task
By computer program, or otherwise, find the Golden Hour for today.
Relates to Objectives
1.1 1.2 1.3 1.4 2.1 2.2 2.4 2.7 2.9 3.3 3.4 3.5 4.2 4.3 4.8
(2 point, Group)

More products