My favorites | Sign in
Project Logo
                
Search
for
Updated Nov 23, 2008 by azerkoculu
Labels: Featured, Phase-Implementation
USAGE_EXAMPLE  

FILES

  1. chessengine.py: Main module.
  2. test.py: Unit test.
  3. basic_ui.py: Basic interface to playing&testing.
  4. pieceset.py: Piece sets.

Example

from chessengine import Board
from pieceset import default as defaultset

board = Board(defaultset)

# a2 square
a2 = board.square[0][1] # x:0 y:1
# a4 square
a4 = board.square[0][4] # x:0 y:3

# move a pawn which is located in a2, to a4
pawn = a2.piece

if pawn.movement.count(a4): # has it got the a4 square in it's movement array?
   pawn.move(a4)

Sign in to add a comment
Hosted by Google Code