=48 && intval($ascii_code) <=57) { continue; } else { return false; } } return true; } $spaces = array( '1' => 'g1', '2' => 'e1', '3' => 'c1', '4' => 'a1', '5' => 'h2', '6' => 'f2', '7' => 'd2', '8' => 'b2', '9' => 'g3', '10' => 'e3', '11' => 'c3', '12' => 'a3', '13' => 'h4', '14' => 'f4', '15' => 'd4', '16' => 'b4', '17' => 'g5', '18' => 'e5', '19' => 'c5', '20' => 'a5', '21' => 'h6', '22' => 'f6', '23' => 'd6', '24' => 'b6', '25' => 'g7', '26' => 'e7', '27' => 'c7', '28' => 'a7', '29' => 'h8', '30' => 'f8', '31' => 'd8', '32' => 'b8', ); $phrase = $_POST['moves'] . " "; $bPhrase = ""; for($x = 0; $x < strlen($phrase); $x++){ if (is_num($phrase[$x])){ if ($phrase[$x+1]=='.'){ $bPhrase = $bPhrase . $phrase{$x}; } elseif (is_num($phrase[$x+1])){ if ($phrase[$x+2]=='.'){ $bPhrase = $bPhrase . $phrase{$x}; $x++; $bPhrase = $bPhrase . $phrase{$x}; } else { $bPhrase = $bPhrase . $spaces[$phrase{$x} . $phrase{$x+1}]; $x++; } } else { $bPhrase = $bPhrase . $spaces[$phrase{$x}]; } } else { $bPhrase = $bPhrase . $phrase{$x}; } } $phrase = $bPhrase; ?>
This tool was designed to allow you to enter checkers moves in standard notation and convert them to (a-h)(1-8) grid form.
To download the source code for this tool, and for other neat things, visit www.phrebh.com.