I got it right too - but my answer was cybunnygrarrlmynci .
Code:
/**
* Produces solutions for Lenny Conundrum 183, using two different interpretations.
*
* @author (Alexander Yuan / AySz88)
* @version (September 14, 2006)
* Released into the public domain.
* Most easily used with BlueJ
*/
public class LennyConund14Sept2006
{
public static String[] species = {"Shoyru", "Kougra", "Kacheek", "Lupe", "Uni", "Gelert", "Eyrie", "Acara", "JubJub", "Grundo",
"Ixi", "Bruce", "Mynci", "Usul", "Wocky", "Xweetok", "Scorchio", "Zafara", "Grarrl", "Aisha", "Kau", "Meerca",
"Flotsam", "Peophin", "Elephante", "Quiggle", "Nimmo", "Chia", "Korbat", "Pteri", "Skeith", "Techo", "Blumaroo", "Kyrii",
"Yurble", "Bori", "Buzz", "Tuskaninny", "Moehog", "Ruki", "Lenny", "Kiko", "Ogrin", "Jetsam", "Gnorbu", "Cybunny", "Poogle",
"Chomby", "Koi", "Tonu", "Hissi", "Lutari", "Draik", "Krawk"};
/**
* Constructor for objects of class LennyConund06Sept2006
* (Acts like a main())
*/
public LennyConund14Sept2006()
{
int[] values = getCounts();
for(int i = 0; i < values.length; i++)
for(int j = i+1; j < values.length; j++) // not starting at 0 because don't need to go through combinations already done
for(int k = j+1; k < values.length; k++) // same
if (values[i] + values[j] + values[k] == 203) System.out.println(species[i] + ", " + species[j] + ", " + species[k]);
System.out.println("Done!");
}
/**
* Produces an array of point values for String[] species
*
* @return an array of integers (point values), in the same order as species
*/
public static int[] getCounts()
{
int[] vals = new int[species.length];
for (int i = 0; i < vals.length; i++) vals[i]=0; //just in case
for (int i = 0; i < species.length; i++)
{
char[] chs = species[i].toLowerCase().toCharArray();
// At first I thought it meant this...
///*
vals[i] += 2*value(chs[0]);
for (int j = 1; j < chs.length; j++)
vals[i] += value(chs[j]);
//*/
// but instead, it could have meant this:
/*
for (int j = 0; j < chs.length; j++)
{
if (chs[j] == chs[0]) vals[i] += 2*value(chs[j]);
else vals[i] += value(chs[j]);
}
*/
}
for (int i = 0; i < vals.length; i++)
System.out.print(vals[i] + ", ");
System.out.print("\n");
return vals;
}
public static int value(char c)
{
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
return - ((int) c - 96);
else
return (int) c - 96;
}
}
First interpretation (first letter only the first time it appears):
The output wrote:
53, 10, 33, 14, -37, 54, 19, 17, -8, 14, -3, -1, 59, -32, 70, 77, 31, 73, 79, 15, 0, 36, 60, 41, 49, 25, 30, 4, 46, 56, 63, 31, -5, 47, 56, -2, 35, 106, 6, 17, 72, 9, 0, 66, 12, 65, 16, 39, -2, 18, 36, 31, 27, 73,
Shoyru, Xweetok, Zafara
Shoyru, Xweetok, Krawk
Gelert, Wocky, Grarrl
Gelert, Xweetok, Lenny
Mynci, Grarrl, Cybunny
Wocky, Xweetok, Pteri
Wocky, Xweetok, Yurble
Wocky, Zafara, Flotsam
Wocky, Flotsam, Krawk
Wocky, Tuskaninny, Draik
Xweetok, Grarrl, Kyrii
Xweetok, Flotsam, Jetsam
Scorchio, Tuskaninny, Jetsam
Grarrl, Tuskaninny, Tonu
Peophin, Pteri, Tuskaninny
Peophin, Yurble, Tuskaninny
Quiggle, Tuskaninny, Lenny
Techo, Tuskaninny, Jetsam
Tuskaninny, Jetsam, Lutari
Lenny, Jetsam, Cybunny
Done!
Second interpretation (first letter every time it appears):
The output wrote:
53, 10, 44, 14, -37, 54, 14, 15, 2, 14, -12, -1, 59, -53, 70, 77, 31, 73, 79, 14, 0, 36, 60, 57, 39, 25, 30, 4, 46, 56, 63, 31, -5, 47, 56, -2, 35, 106, 6, 17, 72, 20, 0, 66, 12, 65, 16, 39, -2, 18, 36, 31, 27, 84,
Shoyru, Kacheek, Tuskaninny
Shoyru, Xweetok, Zafara
Shoyru, Jetsam, Krawk
Gelert, Wocky, Grarrl
Gelert, Xweetok, Lenny
Gelert, Cybunny, Krawk
Mynci, Grarrl, Cybunny
Mynci, Flotsam, Krawk
Wocky, Xweetok, Pteri
Wocky, Xweetok, Yurble
Wocky, Zafara, Flotsam
Wocky, Tuskaninny, Draik
Xweetok, Grarrl, Kyrii
Xweetok, Flotsam, Jetsam
Xweetok, Tuskaninny, Kiko
Scorchio, Tuskaninny, Jetsam
Zafara, Korbat, Krawk
Grarrl, Tuskaninny, Tonu
Quiggle, Tuskaninny, Lenny
Pteri, Skeith, Krawk
Skeith, Yurble, Krawk
Techo, Tuskaninny, Jetsam
Kyrii, Lenny, Krawk
Tuskaninny, Jetsam, Lutari
Lenny, Jetsam, Cybunny
Done!