[racket] Using Racket to solve Professor Layton puzzles

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Tue Jul 26 14:41:55 EDT 2011

My blog now has what I believe is a solution. At least, the test case
you provide passes and the next few elements make sense.

Jay

On Tue, Jul 26, 2011 at 2:15 PM, Eli Barzilay <eli at barzilay.org> wrote:
> Two minutes ago, Danny Yoo wrote:
>> > Speaking about puzzles, here's another cute one: find how to continue
>> > this sequence of numbers:
>> >
>> >  1 1 2 1 1 2 2 1 2 2 1 1 2 2 2 1 3 2 ...
>>
>> Cute.  It's self-describing, no?  The next few numbers would be
>>
>> >  1 1 2 1 1 2 2 1 2 2 1 1 2 2 2 1 3 2 ...
>>
>> 1 1 1 3 1 2 3 1 1 3 1 1 1 2 1 3 2 1 1 3 3 1
>
> Yes.  Now for the cuter thing, do it in lazy racket.  The obvious code
> fails in an interesting way.  When you see that, it leads to an
> interesting question of whether you *can* produce this sequence
> infinitely or if there's a point where you won't be able to continue.
> A related question is whether printing the sequence in a loop will
> ever make you run out of memory.
>
> (I think that the answers to both questions is "yes", but that
> requires a proper proof...)
>
> --
>          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                    http://barzilay.org/                   Maze is Life!
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93



Posted on the users mailing list.