*Playing with memory*

* *

Sindhu and Alistair play a memory game involving of a sequence of random

numbers between *1 *and *10*, inclusive, that is called out one at a time.



Each player can remember up to *5 *previous numbers. When the called

number is in a player's memory, that player is awarded a point. If it's not,

the player adds the called number to his memory, removing another number

if his memory is full.



Both players start with empty memories. Both players always add new

missed numbers to their memory but use a different strategy in deciding

which number to remove:



Sindhu's strategy is to remove the number that hasn't been called in the

longest time.



Alistair's strategy is to remove the number that's been in the memory the

longest time.



Example game:

*Turn*

*Called*

*number*



*Sindhu's*

*memory*

*Sindhu's*

*score*



*Alistair's*

*memory*



*Alistair's*

*score*

1

1

1

0

1

0

2

2

1,2

0

1,2

0

3

4

1,2,4

0

1,2,4

0

4

6

1,2,4,6

0

1,2,4,6

0

5

1

1,2,4,6

1

1,2,4,6

1

6

8

1,2,4,6,8

1

1,2,4,6,8

1

7

10

1,4,6,8,10

1

2,4,6,8,10

1

8

2

1,2,6,8,10

1

2,4,6,8,10

2

9

4

1,2,4,8,10

1

2,4,6,8,10

2

10

1

1,2,4,8,10

2

1,4,6,8,10

3



Denoting Sindhu's score by *S *and Alistair's score by *A*.



The game is for a total of 20 called numbers, with the property that all

numbers would be called equal number of times (2 times each across 20

call-outs).



Given a set of 20 called numbers in a sequence, identifiy the winner of
this game the earliest in the sequence.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to