=48 && intval($ascii_code) <=57) { continue; } else { return false; } } return true; } function splitPos($s){ $rets = array(); $rets = explode('|',$s); array_unshift($rets,"blank"); unset($rets[0]); return $rets; } function unsplitPos($a){ $rets = ""; $rets = implode('|',$a); return $rets; } function createSpacesArr($str){ $ret = array(); $stor = array(); $stor = splitPos($str); foreach($stor as $i => $v){ switch ($v){ case 'r': $txt = 'red'; break; case 'g': $txt = 'green'; break; case 'w': $txt = 'white'; break; case 'rk': $txt = 'redk'; break; case 'wk': $txt = 'whitek'; break; } $ret[$i] = $txt; } return $ret; } function createMoveListS($str){ $ret = ""; $x=0; while ($x < strlen($str)){ if (is_num($str[$x])){ if (is_num($str[$x+1])){ if ($str[$x+2]=='x'){ if ($str[$x+4]=='x' || $str[$x+5]=='x'){ $ret = $ret . $str[$x] . $str[$x+1] . $str[$x+2] . $str[$x+3]; if (is_num($str[$x+4])){ $ret = $ret . $str[$x+4]; } $ret = $ret . '|'; $x+=2; } else { $ret = $ret . $str[$x] . $str[$x+1] . $str[$x+2]; $x+=2; } } elseif ($str[$x+2]=='-'){ $ret = $ret . $str[$x] . $str[$x+1] . $str[$x+2]; $x+=2; } elseif ($str[$x+2]=='.'){ $x+=2; } else { $ret = $ret . $str[$x] . $str[$x+1] . '|'; $x+=2; } } elseif ($str[$x+1]=='x'){ if ($str[$x+3]=='x' || $str[$x+4]=='x'){ $ret = $ret . $str[$x] . $str[$x+1] . $str[$x+2]; if (is_num($str[$x+3])){ $ret = $ret . $str[$x+3]; } $ret = $ret . '|'; $x++; } else { $ret = $ret . $str[$x] . $str[$x+1]; $x++; } } elseif ($str[$x+1]=='-'){ $ret = $ret . $str[$x] . $str[$x+1]; $x++; } elseif ($str[$x+1]=='.'){ $x++; } else { $ret = $ret . $str[$x] . '|'; $x++; } } $x++; } $ret = rtrim($ret,"|"); return $ret; } function createMoveListG($str){ $grd = array('g1'=>'1','e1'=>'2','c1'=>'3','a1'=>'4','h2'=>'5','f2'=>'6','d2'=>'7','b2'=>'8','g3'=>'9','e3'=>'10','c3'=>'11','a3'=>'12','h4'=>'13','f4'=>'14','d4'=>'15','b4'=>'16','g5'=>'17','e5'=>'18','c5'=>'19','a5'=>'20','h6'=>'21','f6'=>'22','d6'=>'23','b6'=>'24','g7'=>'25','e7'=>'26','c7'=>'27','a7'=>'28','h8'=>'29','f8'=>'30','d8'=>'31','b8'=>'32'); $retg = ""; $str = trim($str); $str = str_replace("!","",$str); foreach($grd as $i => $v){ $str = str_replace($i,$v,$str); } $retg = createMoveListS($str); return $retg; } function movePieces($pos,$mov){ $jumpList = array('1x10'=>'6','2x9'=>'6','2x11'=>'7','3x10'=>'7','3x12'=>'8','4x11'=>'8','5x14'=>'9','6x13'=>'9','6x15'=>'10','7x14'=>'10','7x16'=>'11','8x15'=>'11','9x18'=>'14','10x17'=>'14','10x19'=>'15','11x18'=>'15','11x20'=>'16','12x19'=>'16','13x22'=>'17','14x21'=>'17','14x23'=>'18','15x22'=>'18','15x24'=>'19','16x23'=>'19','17x26'=>'22','18x25'=>'22','18x27'=>'23','19x26'=>'23','19x28'=>'24','20x27'=>'24','21x30'=>'25','22x29'=>'25','22x31'=>'26','23x30'=>'26','23x32'=>'27','24x31'=>'27','32x23'=>'27','31x24'=>'27','31x22'=>'26','30x23'=>'26','30x21'=>'25','29x22'=>'25','28x19'=>'24','27x20'=>'24','27x18'=>'23','26x19'=>'23','26x17'=>'22','25x18'=>'22','24x15'=>'19','23x16'=>'19','23x14'=>'18','22x15'=>'18','22x13'=>'17','21x14'=>'17','20x11'=>'16','19x12'=>'16','19x10'=>'15','18x11'=>'15','18x9'=>'14','17x10'=>'14','16x7'=>'11','15x8'=>'11','15x6'=>'10','14x7'=>'10','14x5'=>'9','13x6'=>'9','12x3'=>'8','11x4'=>'8','11x2'=>'7','10x3'=>'7','10x1'=>'6','9x2'=>'6'); $backRows = array('1','2','3','4','29','30','31','32'); $ret = array(); $arrPos = array(); $arrMove = array(); $arrPos = splitPos($pos); $curMoveEnd = strpos($mov,'|'); if ($curMoveEnd===false){ $curMove = $mov; $mov = ""; } else { $curMove = substr($mov,0,$curMoveEnd); $mov = substr($mov, $curMoveEnd+1, strlen($mov)); } if (isset($jumpList[$curMove])){ $curJump = $jumpList[$curMove]; if ($arrPos[$curJump]=='g') die('Invalid jump: ' . $curJump); $arrMove = explode('x',$curMove); $movFir = $arrMove[0]; $movSec = $arrMove[1]; if (($arrPos[$movFir]=='r' || $arrPos[$movFir]=='w') && in_array($movSec,$backRows)){ $arrPos[$movSec] = $arrPos[$movFir] . 'k'; } else { $arrPos[$movSec] = $arrPos[$movFir]; } $arrPos[$curJump] = 'g'; $arrPos[$movFir] = 'g'; } else { $arrMove = explode('-',$curMove); $movFir = $arrMove[0]; $movSec = $arrMove[1]; if (($arrPos[$movFir]=='r' || $arrPos[$movFir]=='w') && in_array($movSec,$backRows)){ $arrPos[$movSec] = $arrPos[$movFir] . 'k'; } else { $arrPos[$movSec] = $arrPos[$movFir]; } $arrPos[$movFir] = 'g'; } $posList = unsplitPos($arrPos); $ret[0] = $posList; $ret[1] = $mov; return $ret; } $done = $_POST['done']; $mList = $_POST['mList']; $moves = $_POST['moves']; $format = $_POST['frmt']; $mvps = array(); if ($done=='1'){ $posSpaces = $_POST['pos']; } else { $posSpaces = "r|r|r|r|r|r|r|r|r|r|r|r|g|g|g|g|g|g|g|g|w|w|w|w|w|w|w|w|w|w|w|w"; } if ($mList==Null && $moves!=Null){ if ($format == 'std'){ $mList = createMoveListS($moves); } elseif ($format == 'grd'){ $mList = createMoveListG($moves); } } $mvps = movePieces($posSpaces, $mList); if ($done=='1'){ $posSpaces = $mvps[0]; $mList = $mvps[1]; } $spaces = createSpacesArr($posSpaces); ?> Checkers/Draughts Game Reviewer

Checkers/Draughts Game Reviewer

This tool was designed to review the moves in a game on a checkerboard.

To use it, type in the moves in either standard notation (using full multiple jump format as detailed in section 6.1.1.2.2 of the PDN2 standard) or grid notation and then click Start. It will show you the first move and allow you to step through the remaining moves.

To download the source code for this tool, and for other neat things, visit www.phrebh.com.











Moves:

ACF
Grid

  Done.