For Programmers: Free Programming Magazines  


Home > Archive > Matlab > April 2005 > Faster numbers game









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Faster numbers game
Murphy O'Brien

2005-04-22, 4:04 pm


I've written two functions which solve the UK Channel 4 TV quiz,
Countdown .

There are two games in Countdown.

In the letters game, the two players try and make the longest word they
can from nine randomly selected letters. (The player whose turn it is
can choose a random vowel or a random consonant)

In the numbers game the two players use their arithmetic skills in
order to get to a target number using only the six random numbers
they've got and the four basic number operations.

The numbers are chosen from a board which contains the numbers from 1
to 10 twice over, and one each of 25, 50, 75 and 100. Contestants can
ask for any combination of small and large numbers.

In both games the players are given 30 seconds of thinking time.

I have uploaded my functions to the file exchange area at
http://www.mathworks.com/matlabcent...objectType=file

The problem I'm having is that while the letters game is solved in a
second or two, the numbers game often takes over a minute to solve.

I have uploaded a loop version and a vectorised version. Both of them
use very large cell arrays.

If any of you have the inclination, I would love if it could be speeded
up by a factor of about 5.


Murphy.

Steve Amphlett

2005-04-22, 4:04 pm

Murphy O'Brien wrote:
>
>
>
> I've written two functions which solve the UK Channel 4 TV quiz,
> Countdown .
>
> There are two games in Countdown.
>
> In the letters game, the two players try and make the longest word
> they
> can from nine randomly selected letters. (The player whose turn it
> is
> can choose a random vowel or a random consonant)
>
> In the numbers game the two players use their arithmetic skills in
> order to get to a target number using only the six random numbers
> they've got and the four basic number operations.
>
> The numbers are chosen from a board which contains the numbers from
> 1
> to 10 twice over, and one each of 25, 50, 75 and 100. Contestants
> can
> ask for any combination of small and large numbers.
>
> In both games the players are given 30 seconds of thinking time.
>
> I have uploaded my functions to the file exchange area at
> <http://www.mathworks.com/matlabcent...objectType=file>
>
> The problem I'm having is that while the letters game is solved in
> a
> second or two, the numbers game often takes over a minute to solve.
>
> I have uploaded a loop version and a vectorised version. Both of
> them
> use very large cell arrays.
>
> If any of you have the inclination, I would love if it could be
> speeded
> up by a factor of about 5.


Ignoring the question completely for now (sorry Murphy), can your
program solve the unseen countdown game mentioned on this site:

<[url]http://www.ggifts.co.uk/countdown[/url]>
Murphy O'Brien

2005-04-22, 4:04 pm

> Murphy O'Brien wrote:
> SNIP: Wants to speed up numbers game x5.
>
>Steve Amphlett wrote:
> Link to the episode they wouldn't show
> <[url]http://www.ggifts.co.uk/countdown[/url]>


It would happen on an all clegyman special!

and yes the solutions are:

Found 7 x 7 letters
canfuls
cansful
capfuls
unclasp
panfuls
flaunts
pulsant
Found 0 x 8 letters
Found 0 x 9 letters

No nine letter words! Hmmm... perhaps it's a specialist medical term.

Murphy
Murphy O'Brien

2005-04-23, 3:59 am

Murphy O'Brien wrote:
>
>
>
> It would happen on an all clegyman special!
>
> and yes the solutions are:
>
> Found 7 x 7 letters
> canfuls
> cansful
> capfuls
> unclasp
> panfuls
> flaunts
> pulsant
> Found 0 x 8 letters
> Found 0 x 9 letters
>
> No nine letter words! Hmmm... perhaps it's a specialist medical
> term.
>
> Murphy


This thread gave me a clever way of doubling the speed of the letters
game (From ~2 seconds to ~1 second)
vi b, "The fastest way of comparion" #, 19 Apr 2005 6:22 pm </WebX?14@@.ef03552>


I had to change it slightly because with my problem I needed the
index of the match and I could avoid the FP devils that <us>
pointed to by using 32.^(1:N)' instead of randn(N,1) because i had
limited range integer data. Still its of no real use because my
numbers game takes ~60 seconds and even a human player is only given
half that time. I really cannot believe that I am fster than a
computer at such a computer oriented problem.

Murphy
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com