Re: Puzzle Challenge
- To: mathgroup at smc.vnet.net
- Subject: [mg63598] Re: Puzzle Challenge
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Fri, 6 Jan 2006 05:24:56 -0500 (EST)
- Organization: The University of Western Australia
- References: <dpd7j1$qj6$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <dpd7j1$qj6$1 at smc.vnet.net>, Paul <gleam at flashmail.com> wrote: > No interest? How disappointing. > > Hartmut Wolf, Carl Woll, Bobby Treat, and Andrzej Kozlowski, where are you? > Show us the way! Mathematica has a built-in dictionary which can be called using NotebookGetMisspellingsPacket This was used in The Mathematica Journal 9(1): 36-37 (2003) to produce all anagrams of a given string. The essential code used is GetMisspelledWords[text_, language_:"English"] := Module[{nb, result}, nb = NotebookPut[Notebook[{Cell[text, "Text", LanguageCategory -> NaturalLanguage, DefaultNaturalLanguage -> language]}, Visible -> False]]; LinkWrite[$ParentLink, NotebookGetMisspellingsPacket[nb]]; result = LinkRead[$ParentLink]; NotebookClose[nb, Interactive -> False]; result] CorrectWords[wl_List, language_:"English"] := Complement[wl,GetMisspelledWords[ToString[Infix[wl," "]], language]]; For example, try CorrectWords[{"the","teh"}] It would be straightforward to use this code to solve your puzzle -- but I'll leave this to others with more time on their hands. Cheers, Paul > > > > A Merry Christmas to all! > > > > > > I offer the following word puzzle as a friendly > > challenge to list participants. > > > > Please consider the game board: > > > > http://www.mathematica-users.org/mediawiki/images/0/03/hexagonpuzzle.gif > > __ > > __/C \__ > > __/O \__/E \__ > > __/L \__/I \__/R \__ > > /D \__/P \__/N \__/U \ > > \__/E \__/R \__/A \__/ > > \__/A \__/T \__/ > > \__/S \__/ > > \__/ > > > > The goal is to find as many words as possible of > > length five or > > greater that each can be spelled by starting on a > > hexagonal token and > > hopping from one token to the next. > > > > You may use a token multiple times while spelling a > > word, but not > > twice in a row. For example, you may spell APART but > > not COOLED. > > > > Your program should work on a puzzle with arbitrarily > > chosen letters. > > > > Your solution will not be judged, but please put > > effort into your > > algorithm, and tell us what makes it excel. For > > example, was your > > goal to write the most concise function? The most > > elegant? Fastest? Unusual? A a robust function > > that will solve a > > larger set of puzzles? > > > > You will need word lists (dictionary files) and I > > recommend ENABLE2k > > or the even larger YAWL, both available from: > > > > http://personal.riverusers.com/~thegrendel/software.html > > > > I hope you will really enjoy working this puzzle, as > > well as seeing > > each other's results! > > > > Paul > > > > _______________________________________________________________________ Paul Abbott Phone: 61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) AUSTRALIA http://physics.uwa.edu.au/~paul