Okay, I gave in as a warm up this morning.
My very basic solution, no comments and a bit ugly, ....
---------------------------------
link strings,ximage
procedure main(arglist)
local S,T,x,y,z
S := States()
T := table()
every (x := !S ) & ( y := !S) do
if z := csort(x || (x << y)) then {
/T[z] := []
put(T[z],[x,y])
}
every z := key(T) do
if *T[z] > 1 then write(ximage(T[z]))
end
procedure States()
local S
S := set()
every insert(S,deletec(map(genStates()),' \t')) # ignore case & white
return S
end
procedure genStates()
every suspend !["Alabama", "Alaska", "Arizona", "Arkansas",
"California", "Colorado", "Connecticut",
"Delaware", ## "District of Columbia",
"Florida", "Georgia", "Hawaii",
"Idaho", "Illinois", "Indiana", "Iowa",
"Kansas", "Kentucky", "Louisiana",
"Maine", "Maryland", "Massachusetts", "Michigan",
"Minnesota", "Mississippi", "Missouri", "Montana",
"Nebraska", "Nevada", "New Hampshire", "New Jersey",
"New Mexico", "New York", "North Carolina", "North Dakota",
"Ohio", "Oklahoma", "Oregon",
"Pennsylvania", "Rhode Island",
"South Carolina", "South Dakota", "Tennessee", "Texas",
"Utah", "Vermont", "Virginia",
"Washington", "West Virginia", "Wisconsin", "Wyoming"]
end
---------------------------------
The output ...
---------------------------------
L127 := list(2)
L127[1] := L128 := list(2)
L128[1] := "northcarolina"
L128[2] := "southdakota"
L127[2] := L157 := list(2)
L157[1] := "northdakota"
L157[2] := "southcarolina"
---------------------------------
----- Original Message ----
From: Steve Wampler <[EMAIL PROTECTED]>
To: Unicon <unicon-group@lists.sourceforge.net>
Sent: Tuesday, April 10, 2007 12:35:47 PM
Subject: [Unicon-group] A new puzzle
Hi Group,
It's been a while since I've put out a challenge, but Steve Hunter sent
me the following puzzle that just begs for a Unicon or Icon solution:
My sense of wordplay was naturally piqued this weekend when I heard
the latest weekly puzzle challenge from Will Shortz on NPR Weekend
Edition. The challenge, from contributor David Edelheit, read as follows:
“Take the names of two U.S. States, mix them all together, then
rearrange the letters to form the names of two other U.S. States.
What states are these?”
There are solutions that take advantage of knowledge of the State names
and there are more general solutions. Write a Unicon/Icon program for
either type of solution. If you write a general solution and would like
me to test it against some "interesting" input, send it to me. Heck, if
you write any solution, I'd like to see it!
I'll post my solution in a few days.
Here are the State names:
--------------------------------------------------------------
procedure getStates()
return ["Alabama", "Alaska", "Arizona", "Arkansas",
"California", "Colorado", "Connecticut",
"Delaware", ## "District of Columbia",
"Florida", "Georgia", "Hawaii",
"Idaho", "Illinois", "Indiana", "Iowa",
"Kansas", "Kentucky", "Louisiana",
"Maine", "Maryland", "Massachusetts", "Michigan",
"Minnesota", "Mississippi", "Missouri", "Montana",
"Nebraska", "Nevada", "New Hampshire", "New Jersey",
"New Mexico", "New York", "North Carolina", "North Dakota",
"Ohio", "Oklahoma", "Oregon",
"Pennsylvania", "Rhode Island",
"South Carolina", "South Dakota", "Tennessee", "Texas",
"Utah", "Vermont", "Virginia",
"Washington", "West Virginia", "Wisconsin", "Wyoming"]
end
----------------------------------------------------------------
Have fun.
--
Steve Wampler -- [EMAIL PROTECTED]
The gods that smiled on your birth are now laughing out loud.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group