aboutsummaryrefslogtreecommitdiff
path: root/challenge-052/duncan-c-white/README
blob: 557a59563d09a1e1215372ce2d3e7931b3baa902 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Task 1: "Stepping Numbers

Write a script to accept two numbers between 100 and 999. It should then
print all Stepping Numbers between them.

    A number is called a stepping number if the adjacent digits have a
    difference of 1. For example, 456 is a stepping number but 129 is not.
"

My notes: Sounds simple.


Task #2: "Lucky Winner

Suppose there are following coins arranged on a table in a line in
random order.

    �1, 50p, 1p, 10p, 5p, 20p, �2, 2p

Suppose you are playing against the computer. Player can only pick one
coin at a time from either ends. Find out the lucky winner, who has the
larger amounts in total?
"

My notes: umm.. with this wording, it wasn't very clear what exactly we're
being asked to do, so the wording I've chosen is:

  "Suppose the following coins are arranged in a line, but in
   a different random order each game:

    �1, 50p, 1p, 10p, 5p, 20p, �2, 2p

   A human is playing against the computer. Pick a random player to go
   first, after that players play alternative moves.  Each move, either pick
   the FIRST coin or the LAST coin.  The winner is the player with the greatest
   amount of money.  Write a program to play the whole game, with a computer
   move choice method with the greatest choice of winning.
  "

Given this understanding, and those specific coin values, then whoever picks
up the �2 coin will win.  obviously if the �2 coin is initially at one end,
picking it is the correct move, otherwise both players should ensure they do
not give the other player the opportunity to pick the �2 coin next move.
ie. avoid leaving the �2 coin at either end..

In practice: the first player alway wins, so rather a dull game.
If playing second, the best the computer can do is pounce on a human
mistake.
#