|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
Re: (Golf) The Perl Bogglesby chipmunk (Parson) |
| on Mar 02, 2002 at 20:05 UTC ( #148877=note: print w/ replies, xml ) | Need Help?? |
|
This golf challenge is tricky, because the design is opposite from how one would usually approach Boggle. Not that this is a bad thing; it makes the challenge more interesting! Usually, when playing Boggle, you start with a list of words, and search the grid for all the words in the list. (In real life, the word list is your vocabulary. In a program, it might be /usr/dict or some other word list.) In this golf challenge, you start with the grid, and then you get one word at a time that you try to find, and you can stop searching as soon as you find the word. Here's my solution. I went for the bonus points using $n as the board size. It's 195 characters; surely a shorter solution is possible! In my testing code, WATER, VETO and WASTE can be found in the grid. The original node doesn't specify, but in the rules of Boggle a single cube cannot be used twice in the same word. So, WASTES can't be found because the S would be used twice.
In Section
Meditations
|
|
||||||||||||||||||||