#!/usr/bin/perl
use warnings;
use strict;
my @array = (1,1,1,1,1,1);
my $len = 20000;
my $main;
my $chars = "UDFBLR2'";
for ($main = 0; $main < $len; $main++) {
my $poss_moves;
my $i = 0;
for (; $i < 6; $poss_moves += $array[$i++]) {} # Find out how many possible moves there are
my $rand = int(rand($poss_moves)) + 1; # Then generate a number depending on that number
my $index = 0;
for ($i = 0; $i < $rand; $i += $array[$index++]) {} # Pick the array index of that set bit
#print $index . " ";
$index--;
# The next three lines turn on the "groups" that this turn is not in
if (int($index/2) == 0) { @array[2 .. 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 .. 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));
print substr($chars,$index,1) . (($rand) ? substr($chars,$rand+5,1) : "") . " ";
}
print "\n";