Class: Loc

Table of Contents

Class: Loc | chess.py
--- | ---
A raw location on the board, represented as a file (x) and a rank (y) value, both indexing from zero.
Methods |
--- | ---
__add__ __cmp__ __getitem__ __init__ __repr__ | __sub__ match normalize traverse tuple
| __add__
    __add__ ( self,  other )
Vector sum.
| __cmp__
    __cmp__ ( self,  other )
Not very meaningful for inequalities.
| __getitem__
    __getitem__ ( self,  key )
Index as a sequence.
Exceptions |
--- | ---
KeyError, "key must be in 0, 1"
| __init__
    __init__ (
            self,
            x,
            y,
            )
| __repr__
    __repr__ ( self )
| __sub__
    __sub__ ( self,  other )
Vector difference.
| match
    match ( self,  pattern )
Match SELF against a PATTERN, where PATTERN is a Loc in which wildcards are represented with a None.
| normalize
    normalize ( self )
Maintain directions but make components size no more than 1.
| traverse
    traverse (
            self,
            other,
            delta,
            )
Return a path from SELF to OTHER (not including SELF, but including OTHER if appropriate), counting by increments of DELTA. Return None if no such path is possible.
| tuple
    tuple ( self )
Return the location as a tuple.

Table of Contents

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