Alright... you guys are using big words like renooberate and such. So here is something I've squished together. I tried to make the fy shuffle a one liner, but I couldn't quite rap my brain around it.
Really the only reason I'm even doing this is because my friend wanted to make a boggle program in c and I figured I'd show him up and do everything he's implemented in under 500 lines of code if I could hehe.
If any of you have any suggestions let me know. I didn't want to post the part that contains the word list and matching because it doesn't work yet and the word list is contained in the perl script. No sense in posting a 200k or so program when only 500 characters of it works so far hehe.
For those of you who like boggle here it is. Given enough time this may actually turn into something a little more interesting with an interface and such.
@dice = qw(foxrib moqabj furilw setupl camped acitao slcrae romash
nodesw hefiye onudtk tevign anedvz pinesh abilyt gkyleu);
$board = join "", &make_board(fy_shuffle(@dice));
$board =~ s/([^\n]{4})/$1\n/g;
print $board;
sub make_board {
my @board, $i;
$board[$i++] = substr $_, int rand length, 1 foreach @_;
return @board;
} # make_board
sub fy_shuffle {
for (my $i = @array; -- $i;) {
my $r = int rand (1 + $i);
@_ [$i, $r] = @_ [$r, $i] unless $r == $i;
}
return @_;
} # fy_shuffle
UPDATE:
Apparently I wasn't being as clever as I though (as Chipmunk pointed out) so I put the perl code back to what I had originally done for the fy_shuffle.