#!/usr/bin/perl
use warnings;
use strict;
my @array = (1,1,1,1,1,1);
my $len = 25;
my $main = 0;
my $chars = "UDFBLR2'";
for ($main = 0; $main < $len; $main++) {
my $poss_moves;
my $i = 0;
# Find out how many possible moves there are
while ($i < 6) {
$poss_moves += $array[$i];
$i++;
}
my $rand = int(rand($poss_moves)) + 1; # Then generate a number depending on number of possible moves
# add one to account for a 0/1 issue with the next section
# Pick the array index of that set bit
my $index = 0;
$i = 0;
while ($i < $rand) {
$i += $array[$index];
$index++;
}
# Adjust $index for that 0/1 problem
$index--;
# The next three lines turn on the "groups" that this turn is not in
if (int($index/2) == 0) { @array[2,3,4,5] = (1,1,1,1); }
if (int($index/2) == 1) { @array[0,1,4,5] = (1,1,1,1); }
if (int($index/2) == 2) { @array[0,1,2,3] = (1,1,1,1); }
# This turns off the move that just happened
$array[$index] = 0;
# make a random char for "" "2" or "'"
$rand = int(rand(3));
#finally, combine the letter and char into one
print substr($chars,$index,1);
if ($rand) { print substr($chars,$rand+5,1); }
print " ";
}
print "\n";