[mercury-users] Mercury Coding Challenge - Battleships

Ralph Becket rwab1 at cam.sri.com
Sun Jan 31 05:57:56 AEDT 1999


Peter Ross wrote on 18 Jan:
> 
> The challenge consists of implementing a server and players for the game
> battleships.  For more information download battleships.tar.gz from
> http://www.cs.mu.oz.au/research/mercury/download/files/battleships/

I've been having a go at this and got to the point where using random
numbers would be fun for the robot player.  However, the modes for the
random module and the modes for the player/1 typeclass predicates mean
they can't be used together.  Player state is handled by threading
(T::in, T::out) <= player(T) pairs throughout the player/1 interface.
The random module predicates, on the other hand, are threaded with
(random__supply::mdi, random__supply::muo) arguments.  Now I can't see
a way of making a random__supply object part of a player/1 instance
and satisfy the mode requirements of both the random module and the
player/1 interface.  Tricky.

This looks like a bug in the player/1 spec.  A game of chance such as
this one really should include a source of random numbers - otherwise
human players will get bored with the robots very quickly!

This has been a public service announcement [unless I'm wrong].

Ralph

-- 
Ralph Becket  |  rwab1 at cam.sri.com  |  http://www.cam.sri.com/people/becket.html



More information about the users mailing list