Source for file Losers.php
Documentation is available at Losers.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at |
// | http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Gregory Beaver <cellog@php.net> |
// +----------------------------------------------------------------------+
// $Id: Losers.php,v 1.3 2004/04/09 06:22:30 cellog Exp $
* A Losers chess game representation (wild 16 on ICC)
* @author Gregory Beaver <cellog@php.net>
require_once 'Games/Chess/Standard.php';
* The goal of the game is to lose all of your pieces or force your opponent
* to checkmate you. The only differences from standard chess are that if
* a capture is possible it must be executed, similar to checkers, and
* checkmate actually loses the game!
* @author Gregory Beaver <cellog@php.net>
* Determine whether it is possible to capture an opponent's piece
$color = $this->_move == 'W' ? 'B' : 'W';
foreach ($this->_pieces as $name => $loc) {
if ($name{0 } == $this->_move) {
// don't return castle move shortcuts
foreach ($this->_pieces as $name => $loc) {
if ($name{0 } == $this->_move || !$loc) {
* @param array parsed move array from {@link _parseMove()}
* @return true|PEAR_Error
* @throws GAMES_CHESS_ERROR_MOVE_MUST_CAPTURE
list ($type, $info) = each($move);
$this->_board[$info['square']] == $info['square'])) {
$san = $info == 'K' ? 'O-O' : 'O-O-O';
$san = $info['piece'] . $info['disambiguate'] . $info['takes'] . $info['square'];
return parent ::_validMove ($move);
* @return W|B|Dwinner of game, or draw
$opposite = $this->_move == 'W' ? 'B' : 'W';
if ($this->inCheckmate ()) {
foreach ($this->_pieces as $name => $loc) {
if (!$loc || $name{1 } == 'K') {
Documentation generated on Sun, 17 Jun 2007 02:00:51 -0400 by phpDocumentor 1.3.2. PEAR Logo Copyright © PHP Group 2004.
|