Table of Contents

Class: Piece chess.py

A piece, on or off the board.

Methods
__init__
```__init__ ( self,  color )

```
__repr__
```__repr__ ( self )

```
cardinal
```cardinal (
self,
start,
end,
max=8,
)

```

Return a cardinal direction path from START to END with no more than MAX moves, or None.

clone
```clone ( self )

```

Make a clone of this piece.

finalize
```finalize (
self,
start,
end,
board,
)

```

After a move from START to END on BOARD is complete, complete any necessary cleanup.

move
```move (
self,
loc,
board,
)

```

Move this piece to LOC on BOARD.

Exceptions
IllegalMoveError, "cannot move"
omni
```omni (
self,
start,
end,
max=8,
)

```

Return an omnidirectional path from START to END with no more than MAX moves, or None.

ordinal
```ordinal (
self,
start,
end,
max=8,
)

```

Return an ordinal (diagonal) direction path from START to END with no more than MAX moves, or None.

path
```path (
self,
start,
end,
)

```

Return a path from START to END.

Exceptions
NotImplementedError, "Piece.path is abstract"
possible
```possible ( self,  board )

```

Return a list of all possible moves for this piece on BOARD.

threat
```threat ( self,  board )

```

Is this piece on BOARD currently under threat?

validate
```validate (
self,
to,
board,
)

```

First phase of move validation; see if this piece can move to TO on BOARD under the allowed rules for this type of piece.

verify
```verify (
self,
to,
board,
)

```

Second phase of move validation; after verifying that TO is a legal move on BOARD for this piece, verify that in the context of the state of the game it is legal; e.g., a piece can make a move that would put its own king in check.

walk
```walk (
self,
path,
board,
)

```

Return true if PATH is a reasonable move on BOARD, independent of piece type.

Table of Contents

This document was automatically generated on Thu Jul 25 17:22:53 2002 by HappyDoc version 2.0.1