Thanks to Arwyn; QuickCheck; that pub puzzle.

10 views
Skip to first unread message

ja...@ioctl.org

unread,
Nov 5, 2013, 3:59:39 PM11/5/13
to brisfun...@googlegroups.com
That was a thoroughly excellent evening. Many thanks to Arwyn for the
evening! (I've been playing with ASPProlog since then - think I've got a
reasonably compact approach for solving the Nonogram problem.)

QuickCheck is a topic that's been mentioned before; and we've promised
ourselves an introduction to it. For a very nice explanation of its
monadic approach, have a look at week one of the Coursera course:
Principles of Reactive Programming
(https://class.coursera.org/reactive-001/lecture/index, might require a
sign-up). I've always been impressed with Martin Odersky's pedagogical
skills; he presents enough to navigate around QuickCheck or its Scala
equivalent in about 20 minutes!

Cheers,
jan

PS. Finally, for those that made the pub: we were presented with a number
of logic problems over our beers. I was quite taken by the "n prisoners
plus a lightbulb" problem: there are a few interesting variants, including
asking how the prisoners might go about exchanging arbitrary messages.
Best (for some values of) solution to the "clocked" version - where a
single prisoner must correctly declare that everyone has entered Room
101 in order to secure their release - I've heard so far had an expected
runtime of about 2x10^31 times the age of the universe for the case
n=100*.

I'm wondering if random strategy generation (in conjunction with
randomised testing) might be usable to locate plausible approaches. That's
tomorrow's homework :-)

* Divide the days up into "weeks" of length n. A visitor to the room
leaves the light alone on their first visit, but turns it on if they make
a subsequent visit within the same n-day "week". At the end of that
period, whoever is in the room switches the light out if it's on;
otherwise they know that a different prisoner must have visited the room
on each of the preceding n days, so they can declare and win everyone's
freedom.

[ Expected runtime = n^(n+1) / n! visits.** ]

** It's possible to do better than this.


--
Update your address books: ja...@ioctl.org http://ioctl.org/jan/
User interface? I hardly know 'er!

ja...@ioctl.org

unread,
Nov 5, 2013, 5:47:34 PM11/5/13
to brisfun...@googlegroups.com
On Tue, 5 Nov 2013, ja...@ioctl.org wrote:

> QuickCheck is a topic that's been mentioned before; and we've promised
> ourselves an introduction to it. For a very nice explanation of its
> monadic approach, have a look at week one of the Coursera course:
> Principles of Reactive Programming
> (https://class.coursera.org/reactive-001/lecture/index, might require a
> sign-up). I've always been impressed with Martin Odersky's pedagogical
> skills; he presents enough to navigate around QuickCheck or its Scala
> equivalent in about 20 minutes!

... it all becomes clear now!

--
Update your address books: ja...@ioctl.org http://ioctl.org/jan/
I am now available for general use under a modified BSD licence.
Reply all
Reply to author
Forward
0 new messages