service { const html Welcome = Welcome to the riddle game! ; const html Pick = There are 5 riddles. You are allowed to make 3 choices.

Please enter a number from 1 to 5: ; const html Trials = Number of riddles read so far is: <[trials]>. ; const html Retry = You have made an invalid choice!

Please enter a number between 1 and 5 only: ; const html Riddle1 = A man is standing in front of a painting of a man, and he tells us the following: Brothers and sisters have I none, but this man's father is my fathers son. Who's on the painting?

a) The Son

b) The Father

c) Himself ; const html Riddle1Sol = The Solution: His son

An Explanation

We can replace my fathers son by myself since he is the only child. Now remains: This man s father is myself, so this man is his son.

; const html Riddle2 = It is dark in my bedroom and I want to get two socks of the same color from my drawer, which contains 24 red and 24 blue socks. How many socks do I have to take from the drawer to get at least two socks of the same color?

a) 2

b) 3

c) 48

d) 25 ; const html Riddle2Sol = The Solution: 3

An Explanation

It is clear that taking 0, 1, or 2 socks is not sufficient. But if you take 3 socks, then either the first and second sock you take have the same color, or the third sock you take from the drawer has the same color as one of the previous two.

; const html Riddle3 = A hunter leaves his cabin early in the morning and walks one mile due south. Here he sees a bear and starts chasing it for one mile due east before he is able to shoot the bear. After shooting the bear, he drags it one mile due north back to his cabin where he started that morning. What color is the bear?

a) Brown

b) White

c) Can not tell ; const html Riddle3Sol = The Solution: White

An Explanation

He can walk one mile due south, then one mile due east and finally one mile due north where he finds his cabin again. This means that his cabin can only be at the north pole, and for that reason the bear will be white.

; const html Riddle4 = One day Alice meets the Lion and the Unicorn in the Forest of Forgetfulness. She knows that the Lion lies on Mondays, Tuesdays, and Wednesdays, and tells the truth on the other days of the week. The Unicorn, on the other hand, lies on Thursdays, Fridays, and Saturdays, but tells the truth on the other days of the week. Now they make the following statements to Alice:

[*] Lion: Yesterday was one of my lying days.

[*] Unicorn: Yesterday was one of my lying days too.

What day is it?

a) Sunday
b) Monday
c) Tuesday
d) Wednesday
e) Thursday
f) Friday
g) Saturday
; const html Riddle4Sol = The Solution: Thursday

An Explanation

The only days the Lion can say that he lied on the previous day are Mondays and Thursdays. The only days the Unicorn can say this, are Thursdays and Sundays. Therefore, the only day they both say that is on Thursday.

; const html Riddle5 = A certain street contains 100 buildings. They are numbered from 1 to 100. How many 9 are used in these numbers?

a) 19

b) 20

c) 21 ; const html Riddle5Sol = The Solution: 20

An Explanation

Just count the nines in the numbers: 9, 19, 29, 39, 49, 59, 69, 79, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99.

; const html Fin = Thanks for playing this game!

BACK ; int choice; session Guess() { int total; int i; total= 0; while (total!=3) { show Welcome; show Pick receive[i = choice]; while ((i>5) || (i==0))show Retry receive[i = choice]; if (i==1) { show Riddle1; show Riddle1Sol; } if (i==2) { show Riddle2; show Riddle2Sol; } if (i==3) { show Riddle3; show Riddle3Sol; } if (i==4) { show Riddle4; show Riddle4Sol; } if (i==5) { show Riddle5; show Riddle5Sol; } total = total + 1; show plug Trials[trials = total]; if (total ==3) {exit Fin;} } } }