cvs: pear /Games_Chess package.xml /Games_Chess/Chess Crazyhouse.php

From: Date: Thu, 16 Nov 2006 06:02:21 +0000
Subject: cvs: pear /Games_Chess package.xml /Games_Chess/Chess Crazyhouse.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-43090@lists.php.net to get a copy of this message
cellog Thu Nov 16 06:02:21 2006 UTC Modified files: /pear/Games_Chess/Chess Crazyhouse.php /pear/Games_Chess package.xml Log: allow placement move to interpose in a check for Crazyhouse variant http://cvs.php.net/viewvc.cgi/pear/Games_Chess/Chess/Crazyhouse.php?r1=1.3&r2=1.4&diff_format=u Index: pear/Games_Chess/Chess/Crazyhouse.php diff -u pear/Games_Chess/Chess/Crazyhouse.php:1.3 pear/Games_Chess/Chess/Crazyhouse.php:1.4 --- pear/Games_Chess/Chess/Crazyhouse.php:1.3 Fri Oct 1 17:34:56 2004 +++ pear/Games_Chess/Chess/Crazyhouse.php Thu Nov 16 06:02:21 2006 @@ -16,7 +16,7 @@ // | Authors: Gregory Beaver <cellog@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Crazyhouse.php,v 1.3 2004/10/01 17:34:56 cellog Exp $ +// $Id: Crazyhouse.php,v 1.4 2006/11/16 06:02:21 cellog Exp $ /** * A standard chess game representation * @package Games_Chess @@ -723,6 +723,25 @@ */ function _interposeOrCapture($squares, $color) { + foreach ($squares as $square) { + // if any squares are unoccupied, and we can place a piece, + // then it is possible to interpose through piece placement + if (!$this->_squareToPiece($square)) { + foreach ($this->_captured[$color] as $name => $count) { + if (!$count) { + continue; + } + if ($name == 'P') { + // can't place on 1 or 8 + if ($square[1] == '1' || $square[1] == '8') { + continue; + } + } + return true; + } + } + } + // placement is not possible, try regular interpose/capture foreach ($this->_pieces[$color] as $name => $pieces) { if ($name == 'K') { continue; http://cvs.php.net/viewvc.cgi/pear/Games_Chess/package.xml?r1=1.16&r2=1.17&diff_format=u Index: pear/Games_Chess/package.xml diff -u pear/Games_Chess/package.xml:1.16 pear/Games_Chess/package.xml:1.17 --- pear/Games_Chess/package.xml:1.16 Thu Nov 16 05:46:45 2006 +++ pear/Games_Chess/package.xml Thu Nov 16 06:02:21 2006 @@ -33,7 +33,9 @@ <api>alpha</api> </stability> <license uri="http://www.php.net/license">PHP License</license> - <notes>convert all unit tests to .phpt format + <notes> + convert all unit tests to .phpt format + allow placement move to interpose in a check for Crazyhouse variant </notes> <contents> <dir baseinstalldir="Games" name="/"> @@ -643,7 +645,9 @@ </stability> <date>2006-11-15</date> <license uri="http://www.php.net/license">PHP License</license> - <notes>convert all unit tests to .phpt format + <notes> + convert all unit tests to .phpt format + allow placement move to interpose in a check for Crazyhouse variant </notes> </release> <release>

« previous php.pear.cvs (#43090) next »