Slightly better diagnostics.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 15 Nov 2014 01:56:31 +0000 (02:56 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 15 Nov 2014 01:56:31 +0000 (02:56 +0100)
Board.pm

index 2edc07d..39c8134 100644 (file)
--- a/Board.pm
+++ b/Board.pm
@@ -200,8 +200,11 @@ sub parse_pretty_move {
                        push @squares, [ $row, $col ];
                }
        }
+       if (scalar @squares == 0) {
+               die "Impossible move $move";
+       }
        if (scalar @squares != 1) {
-               die "Ambigious or impossible move $move";
+               die "Ambigious move $move";
        }
        return (@{$squares[0]}, $to_row, $to_col, $promo);
 }