Wednesday, 8 July 2009

First crack at 2 word permutation generator

A little while has come and I've started coding something that will work. The result is here and the final result (using command line redirection) is here.

Now to finesse the program so that it'll take command line arguments.

Prior to that though I've altered the workhorse bit where the chars are printed to instead of:

System.out.print(a1[a]);
System.out.print(a2[b]);
System.out.print(a3[c]);
System.out.print(a4[d]);
System.out.print(a5[e]);
System.out.print("\n");

We can have:

String newWord = "";
newWord = newWord+a1[a]+a2[b]+a3[c]+a4[d]+a5[e];

A lot neater and it now allows us to do this:

System.out.println(newWord);
System.out.println(newWord+"abc");
System.out.println(newWord+"123");

Rather than use all the millions of lines in the pdf above.

Java char addition does seem to be a bugger though as this will throw an error.

String newWord = a1[a]+a2[b]+a3[c]+a4[d]+a5[e];

Odd ehh?