lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Ag is a fast, scriptable anagram generator with a statically embedded
Lua interpreter (version 5.4.3).  Ag is free, open source and runs on
Windows, Mac and Linux.  Download link and screenshots are here:

The biggest change in this release is that agc (the command line
version of Ag) can now run Lua scripts.  This means it can do a lot
more than simply generate anagrams.  For example:

$ agc -r Scripts/ladders.lua 
Type in 2 words of equal length,
or a single letter followed by a number.
For example:
i4  - find isolated 4-letter words
l5  - find longest ladder using 5-letter words
p6  - print adjacency graph for 6-letter words
[default = sooth flier]
> p2
Building the adjacency graph...
This is the adjacency graph for 35 words of length 2:
AD -> AM AN AS AT ID
AM -> AD AN AS AT
AN -> AD AM AS AT IN ON
AS -> AD AM AN AT IS US
AT -> AD AM AN AS IT
BE -> BY HE ME WE
BY -> BE MY
DO -> GO LO NO SO TO
EX -> OX
GO -> DO LO NO SO TO
HE -> BE HI ME WE
HI -> HE PI XI
ID -> AD IF IN IS IT
IF -> ID IN IS IT OF
IN -> AN ID IF IS IT ON
IS -> AS ID IF IN IT US
IT -> AT ID IF IN IS
LO -> DO GO NO SO TO
ME -> BE HE MR MU MY WE
MR -> ME MU MY OR
MU -> ME MR MY NU
MY -> BY ME MR MU
NO -> DO GO LO NU SO TO
NU -> MU NO
OF -> IF ON OR OX
ON -> AN IN OF OR OX
OR -> MR OF ON OX
OX -> EX OF ON OR
PI -> HI XI
SO -> DO GO LO NO TO
TO -> DO GO LO NO SO
UP -> US
US -> AS IS UP
WE -> BE HE ME
XI -> HI PI

And here is an example using Primes.lex, a numeric lexicon
that contains all the prime numbers less than 1 million:

$ agc -r Scripts/palindromes.lua -l Primes.lex
Finding palindromes in Primes.lex
11
101
131
151
181
... lots of lines deleted ...
97379
97579
97879
98389
98689
Total: 109

The agc binary is included in the Ag distribution but building
your own version should be quite easy (assuming you have
a C++ compiler).  Download and unpack the src tarball, cd to
the cmdline directory and run the appropriate makefile:

nmake -f makefile-win  (on Windows)
make -f makefile-mac  (on macOS; builds a universal binary)
make -f makefile-unix  (on Linux or other Unix system)

Andrew