$currentMove"); if($replacement!=""){ $firstPart = substr ( $currentMove ,0 , strrpos($currentMove, "P")); $secondPart =substr ( $currentMove, strrpos($currentMove, "P")+1, 4); $currentMove="$firstPart$replacement$secondPart"; } if($confirm==10){ $moves="$moves"; }else $moves="$moves$currentMove"; //print($moves); //if($verbose==true) print("$currentMove\n::: moves :: $moves\n::: your side=$your_side"); $eachMoveArray=array(); $tok = strtok ($moves,"|"); while ($tok) { // echo "
FIRST CUT =$tok
"; array_push($eachMoveArray, $tok); $tok = strtok ("|"); } /* if($verbose==true) { print("

"); print(count($eachMoveArray)); print("

"); } */ $board = array( "b-R-a8", "b-N-b8", "b-B-c8", "b-Q-d8", "b-K-e8", "b-B-f8", "b-N-g8", "b-R-h8", "b-P-a7", "b-P-b7", "b-P-c7", "b-P-d7", "b-P-e7", "b-P-f7", "b-P-g7", "b-P-h7", "n-0-a6", "n-0-b6", "n-0-c6", "n-0-d6", "n-0-e6", "n-0-f6", "n-0-g6", "n-0-h6", "n-0-a5", "n-0-b5", "n-0-c5", "n-0-d5", "n-0-e5", "n-0-f5", "n-0-g5", "n-0-h5", "n-0-a4", "n-0-b4", "n-0-c4", "n-0-d4", "n-0-e4", "n-0-f4", "n-0-g4", "n-0-h4", "n-0-a3", "n-0-b3", "n-0-c3", "n-0-d3", "n-0-e3", "n-0-f3", "n-0-g3", "n-0-h3", "w-P-a2", "w-P-b2", "w-P-c2", "w-P-d2", "w-P-e2", "w-P-f2", "w-P-g2", "w-P-h2", "w-R-a1", "w-N-b1", "w-B-c1", "w-Q-d1", "w-K-e1", "w-B-f1", "w-N-g1", "w-R-h1" ); $printMoves=""; $traceMoves=array(); $whitecapture=array(); $blackcapture=array(); //$countToken=moveCount; for($xy=0; $xy < count($eachMoveArray); $xy++){ //print($eachMoveArray[$xy]); if($eachMoveArray[$xy] == "w-o-o"){ $board[60]="n-0-e1"; $board[61]="w-R-f1"; $board[62]="w-K-g1"; $board[63]="n-0-h1"; array_push($track_moved_pieces,$eachMoveArray[$xy]); // for tracking moved piececs array_push($traceMoves, "o-o"); $whiteKingLocation="62-w-K-g1"; } else if($eachMoveArray[$xy] == "w-o-o-o") { $board[56]="n-0-a1"; $board[58]="w-K-c1"; $board[59]="w-R-d1"; $board[60]="n-0-e1"; array_push($track_moved_pieces,$eachMoveArray[$xy]); // for tracking moved piececs array_push($traceMoves, "o-o-o"); $whiteKingLocation="58-w-K-c1"; } else if($eachMoveArray[$xy] == "b-o-o") { $board[4]="n-0-e8"; $board[5]="b-R-f8"; $board[6]="b-K-g8"; $board[7]="n-0-h8"; array_push($track_moved_pieces,$eachMoveArray[$xy]); // for tracking moved piececs array_push($traceMoves, "o-o"); $blackKingLocation="5-b-K-g8"; } else if($eachMoveArray[$xy] == "b-o-o-o") { $board[0]="n-0-a8"; $board[2]="b-K-c8"; $board[3]="b-R-d8"; $board[4]="n-0-e8"; array_push($track_moved_pieces,$eachMoveArray[$xy]); // for tracking moved piececs array_push($traceMoves, "o-o-o"); $blackKingLocation="2-b-K-c8"; } else { /* enpassant */ $is_enpassant=enPassant($moves, $eachMoveArray[$xy], $track_moved_pieces, $board); list ($index_of_enpassant, $new_element) = split ('[:]', $is_enpassant); $board[$index_of_enpassant]="$new_element"; //print ">>> $is_enpassant"; if($index_of_enpassant != ""){ $ep="e.p."; } /* endd enpassant */ $tok2 = strtok ($eachMoveArray[$xy],":"); $arrayOne=array(); $arrayTwo=array(); $arrayThree=array(); $countToken=0; while ($tok2) { //if($verbose==true) $printMoves="$printMoves Actual:::$tok2::::
"; list ($indexIs,$colorIs, $pieceIs,$locationIs) = split ('[-]', $tok2); // if($verbose==true) $printMoves="$printMoves($countToken)     $indexIs, $colorIs, $pieceIs, $locationIs
"; if($countToken==0) { array_push($arrayOne, $indexIs); array_push($arrayOne, $colorIs); array_push($arrayOne, $pieceIs); array_push($arrayOne, $locationIs); // 10.06.2001 $substring_loc = substr($locationIs, 0, 1); // 10.06.2001 array_push($track_moved_pieces,"$colorIs-$pieceIs-$substring_loc"); // for tracking moved piececs } else if ($countToken==1) { array_push($arrayTwo, $indexIs); array_push($arrayTwo, $colorIs); array_push($arrayTwo, $pieceIs); array_push($arrayTwo, $locationIs); } else if ($countToken==2) { array_push($arrayThree, $indexIs); array_push($arrayThree, $colorIs); array_push($arrayThree, $pieceIs); array_push($arrayThree, $locationIs); /* get the location of the kings.. */ if($pieceIs == "K") { //print("king found"); if($colorIs == "w") $whiteKingLocation="$tok2"; else $blackKingLocation=$tok2; } /* get the location of the kings.. */ } $board[$arrayOne[0]]="n-0-$arrayOne[3]"; //$printMoves = "$printMoves
n-0-$arrayOne[3]
$arrayTwo[2]::$arrayOne[1]-$arrayOne[2]-$arrayThree[3]"; $board[$arrayThree[0]]="$arrayOne[1]-$arrayThree[2]-$arrayThree[3]"; //$printMoves = "$printMoves
$arrayThree[0]"; $tok2 = strtok (":"); $countToken++; } /******************** 10.06.2001 *************** START */ if($arrayOne[1]=="w" && $arrayOne[2]=="P"){ if($arrayOne[0] > 47 && $arrayOne[0] < 56) { $pushokay=true; } else { $pushokay=false; } } else if ($arrayOne[1]=="b" && $arrayOne[2]=="P"){ if($arrayOne[0] > 7 && $arrayOne[0] < 16) { $pushokay=true; } else { $pushokay=false; } } else $pushokay=true; $substring_loc = substr($arrayOne[3], 0, 1); if ($pushokay==true) { array_push($track_moved_pieces,"$arrayOne[1]-$arrayOne[2]-$substring_loc"); // for tracking moved piececs } /******************** 10.06.2001 *************** END */ if($arrayThree[2]=="P") { if($arrayTwo[2]!="0") { $justgetletter=substr($arrayOne[3],0,1); array_push($traceMoves, "$justgetletter$putX$arrayThree[3]"); if ($arrayTwo[1]=="b") array_push($blackcapture, score_pieces($arrayTwo[2])); else array_push($whitecapture, score_pieces($arrayTwo[2])); }else array_push($traceMoves, "$arrayThree[3]"); }else if($arrayTwo[2]!="0") { array_push($traceMoves, "$arrayThree[2]x$arrayThree[3]"); if ($arrayTwo[1]=="b") array_push($blackcapture, score_pieces($arrayTwo[2])); else array_push($whitecapture, score_pieces( $arrayTwo[2] ) ); } else array_push($traceMoves, "$arrayThree[2]$arrayThree[3]"); //$printMoves="$printMoves

"; } } if($move_to!="" && $move_from!="" && $confirm==7 ){ if($move_from == "w-o-o"){ array_push($between_K_and_R, $board[61]); array_push($between_K_and_R, $board[62]); $board[60]="n-0-e1"; $board[61]="w-R-f1"; $board[62]="w-K-g1"; $board[63]="n-0-h1"; array_push($traceMoves, "o-o"); $whiteKingLocation="62-w-K-g1"; } else if($move_from == "w-o-o-o") { array_push($between_K_and_R, $board[59]); array_push($between_K_and_R, $board[58]); array_push($between_K_and_R, $board[57]); $board[56]="n-0-a1"; $board[58]="w-K-c1"; $board[59]="w-R-d1"; $board[60]="n-0-e1"; array_push($traceMoves, "o-o-o"); $whiteKingLocation="58-w-K-c1"; } else if($move_from == "b-o-o") { array_push($between_K_and_R, $board[5]); array_push($between_K_and_R, $board[6]); $board[4]="n-0-e8"; $board[5]="b-R-f8"; $board[6]="b-K-g8"; $board[7]="n-0-h8"; array_push($traceMoves, "o-o"); $blackKingLocation="6-b-K-g8"; } else if($move_from == "b-o-o-o") { array_push($between_K_and_R, $board[1]); array_push($between_K_and_R, $board[2]); array_push($between_K_and_R, $board[3]); $board[0]="n-0-a8"; $board[2]="b-K-c8"; $board[3]="b-R-d8"; $board[4]="n-0-e8"; array_push($traceMoves, "o-o-o"); $blackKingLocation="2-b-K-c8"; } else { $org_from=($board[$move_from]); $org_to=($board[$move_to]); //if($verbose==true) print("You are about to move $board[$move_from] to $board[$move_to]"); $ttemp=substr($board[$move_to], 4,2); $tptemp=substr($board[$move_to], 2,1); $twtemp=substr($board[$move_to], 5,1); $ctemp=substr($board[$move_from], 0,3); $color_moved_temp_to=substr($board[$move_to], 0,1); $color_moved_temp=substr($board[$move_from], 0,1); $ptemp=substr($board[$move_from], 2,1); $board[$move_to]="$ctemp-$ttemp"; $ftemp=substr($board[$move_from], 4,2); $pftemp=substr($board[$move_from], 2,1); $board[$move_from]="n-0-$ftemp"; /* get the location of the kings.. */ if($pftemp == "K") { //print("king found $move_to-$ctemp-$ttemp"); if($color_moved == "w") $whiteKingLocation="$move_to-$ctemp-$ttemp"; else $blackKingLocation="$move_to-$ctemp-$ttemp"; } /* get the location of the kings.. */ if($verbose == true) print(" moved_from_piece : $color_moved_temp <1a> $ttemp, 1b> $tptemp, 2a> $ctemp 2b> $twtemp, 2b> $ptemp, 2c> $ftemp, 2d> $pftemp "); if($ptemp=="P") { if($tptemp!="0") { $justgetletter=substr($ftemp,0,1); //array_push($traceMoves, "$justgetletter$putX$arrayThree[3]"); modified :: 06-29-2001 array_push($traceMoves, "$justgetletter$putX$ttemp"); if ($color_moved_temp_to=="b") array_push($blackcapture, score_pieces($tptemp)); else array_push($whitecapture,score_pieces($tptemp)); }else array_push($traceMoves, "$ttemp"); }else if($tptemp!="0") { array_push($traceMoves, "$ptemp$putX$ttemp"); if ($color_moved_temp_to=="b") array_push($blackcapture, score_pieces($tptemp)); else array_push($whitecapture,score_pieces($tptemp)); } else array_push($traceMoves, "$ptemp$put$ttemp"); } /* current move contains the following 1) original piece and location 2) original target piece and location 3) the final location after the move if #2 contained a piece, it means a capture. */ $currentMove="$move_from-$org_from:$move_to-$org_to:$move_to-$ctemp-$ttemp|"; //if($verbose==true) print(" result : $board[$move_from]" ); } print ""; print("
"); print("
"); if( $black_e_mail != "" && $your_side=="b") print("WHITE : $white_e_mail\n"); else if( $white_e_mail != "" && $your_side=="w") print("BLACK : $black_e_mail\n"); print(" 
"); $coloris="black"; $z=1; $p=1; $blackarray; $whitearray; $bArray=array(); $wArray=array(); $selectPosition; /* enpassant */ $is_enpassant=enPassant($moves, $currentMove, $track_moved_pieces, $board); list ($index_of_enpassant, $new_element) = split ('[:]', $is_enpassant); $board[$index_of_enpassant]="$new_element"; //print ">>> $is_enpassant"; if($index_of_enpassant != ""){ print ("enpassant just happend"); // print("$currentMove"); } /* endd enpassant */ /* Flipping the board.. if black, reverse the board */ $numberarray = array(8,7,6,5,4,3,2,1); $alphaarray = array(a,b,c,d,e,f,g,h); if( $your_side=="b") { $board=array_reverse($board); $numberarray=array_reverse($numberarray); $alphaarray=array_reverse($alphaarray); } $p=64; print("\n\n\n"); for ($x=0; $x < 8 ; $x++) { //$numbering=abs($x-8); print(""); for ($y=0; $y < 8 ; $y++) { if ($coloris == "white") $coloris="black"; else $coloris="white"; $p=$y+$x+$nextrow; $pieceColor=substr($board[$p], 0,1); $pieceShapeIs=substr($board[$p], 2,1); $pieceLocation=substr($board[$p], 4,2); if($your_side=="b"){ $p=63-$p; } if($pieceShapeIs=="P"){ $present=""; } else { $present=$pieceShapeIs; } if($pieceColor=="b") { array_push($bArray, "$pieceColor-$pieceShapeIs-$pieceLocation"); $blackarray="$blackarray\n"; } else if($pieceColor=="w") { array_push($wArray, "$pieceColor-$pieceShapeIs-$pieceLocation"); $whitearray="$whitearray\n"; } $selectPosition="$selectPosition\n"; print(""); } $nextrow=$nextrow+7; if ($coloris == "white") $coloris="black"; else $coloris="white"; print("\n"); } print(""); for ($loopx=0 ; $loopx<8; $loopx++){ print(""); } print("
 $numberarray[$x] "); //print("$pieceColor
$pieceShapeIs

$pieceLocation"); if ($pieceShapeIs=="0"){ print("$pieceShape"); //print("
"); if($confirm==6){ print("
"); } else { print("
"); } } else { if($confirm==6){ print("
\n"); } else { print("
\n"); } } print("
 $alphaarray[$loopx]
\n\n"); if( $black_e_mail != "" && $your_side=="b") print("BLACK : $black_e_mail\n"); else if( $white_e_mail != "" && $your_side=="w") print("WHITE : $white_e_mail\n"); print(" 
"); print("
"); /* print captures. */ sort($whitecapture); sort($blackcapture); $w_score=0; $b_score=0; if(count($whitecapture) > 0 || count($blackcapture) > 0 ) { print("

Captured Pieces "); for($xx=0; $xx
"); if($remainder==0) { printf("
", score_reverse_pieces($whitecapture[$xx])); } else { printf("", score_reverse_pieces($whitecapture[$xx])); } } if ($w_score > 0) print "
Total : [$w_score]"; for($yy=0; $yy
"); $remainder=($yy+1) % 8; if($remainder==0) { printf("
", score_reverse_pieces($blackcapture[$yy])); } else { printf("", score_reverse_pieces($blackcapture[$yy])); } } if ($b_score > 0) print "
Total : [$b_score]"; print("

Game Start Date : $madedate"); } /*

*/ /* if($confirm==6){ print("

Exercise BULLSHIT policy : This system has been established to perform illegal activities on this SoundChess Board. If you feel that your opponent has violated the LAW of the Board, Please provide a detailed message at the space provided below and click on the button that says BullShit. As soon as you request BullShit, Your game will be halted as long as The High Society can review your game. You will be notified after the review. "); print("

\n"); print("
\n"); print("\n"); print("

\n"); print("

\n"); print("\n"); print("\n"); print("

\n"); } */ print("

Copyright © 2001-2004 SoundKeepers.
All rights reserved."); ?>

SoundChess Access Count :

"); /* if($identifyNumber!=$moveNumber){ //array_pop($traceMoves); print "Your opponent made a move.
Click HERE to make YOUR MOVE!!

"; } */ // "$termination_date"; include("../../cgi-bin/chess/panel_switch.inc"); print("

"); if(count($traceMoves)>0){ if($message != "" || $message2 !=""){ if($message2 != "") $message = $message2; print("\n
\n"); print("Message : "); print("
"); print(stripslashes($message)); print("

"); } print("\n\n"); print("\n"); else print("\n"); print("
"); print("History"); $number_moves=1; $lastbox=count($traceMoves) % 2; for($m=0; $m$traceMoves[$m]
$number_moves$traceMoves[$m]"); } if($lastbox==1) print(" 
"); print(" 
"); //if($verbose==true) print("$printMoves"); } /* for($n=0; $n < count($track_moved_pieces); $n++) { print "$track_moved_pieces[$n]
"; } */ //sendMessageForTermination($db); //processTermination($db); //print("

\n\n"); ?> */ include("../../cgi-bin/chess/footer.inc"); mysql_close ($db); ?>