Message #150

From: Jay Berkenbilt <ejb@ql.org>
Subject: Re: [MC4D] Could somebody check number of twists in my 2^4 log
Date: Mon, 09 May 2005 12:30:54 -0400

"Remigiusz Durka" <thesamer@interia.pl> wrote:

> Could somebody check my log from 2^4 solution with this Perl Program
> counting only twists? (I have 424 moves and I want to know how many
> twist I’ve done…)I would be very grateful…
>
> Ps. Excuse me that mess with my log..I added to the Solutions, next
> I’ve changed the name. That’s why the link doesn’t work…I added this
> agin. It is somewhere in Solutions…

The twist count is 366 moves. My count_moves.pl script ignores the
full twists of the entire cube that you mentioned and also skips the
moves at the beginning that are responsible for scrambling the puzzle.
I’m attaching a modified version of count_moves.pl – the original one
had a small problem when counting moves on files containing macros
whose bodies don’t fit on one line in the log file. I see that your
solution made use of macros, which is fine, but we’ve made a
distinction between macro solutions and not macro solutions in the
past.

If the fixed version of count_moves.pl should be placed somewhere, the
attached version is a suitable replacement for the original version.

–Jay

#!/usr/bin/perl -w
use strict;

for (my $i = 0; $i < 9; ++$i)
{
scalar(<>);
}
my $total = 0;
outer:
for (<>)
{
chomp;
s/\r//;
my @fields = split(/ /);
for (@fields)
{
$total = 0 if m/m\|/;
last outer if m/\@/;
next unless m/^[0-9]+(:[0-9]+)?.?$/;
++$total;
}
}
print $total, "\n";