Next | Program Repair Shop | 175 |
make_move_pretty has two branches:
451 if ($move =~ /:/) { 452 $move =~ s/^(\d):(\d)/$1$2/; 453 } 454 else { 455 $move =~ s/^\[(\d)\]\[(\d)\]/$1$2/; 456 }
This is because the program has two unrelated representations of moves:
0:2 [0][2]
Actually three, because 02 is a representation also
Why not simply use 02 everywhere?
For example:
287 $z = "[$x][$y]"; 288 if ($move eq $z) {
Becomes
if ($move eq "$x$y") {
Then we could eliminate five lines of code from make_move_pretty
Next | Copyright © 2002 M. J. Dominus |