Skip to content

Commit

Permalink
Remove _Occupancy
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Aug 15, 2015
1 parent b2c61fb commit d9b2dba
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions chess/__init__.py
Expand Up @@ -27,32 +27,6 @@
import re


class _Occupancy(object):
def __init__(self, white=0, black=0):
self.white = white
self.black = black

def __getitem__(self, key):
if key is True:
return self.white
elif key is False:
return self.black
else:
raise KeyError("colors are now boolean: {0}".format(repr(key)))

def __setitem__(self, key, value):
if key is True:
self.white = value
elif key is False:
self.black = value
else:
raise KeyError("colors are now boolean: {0}".format(repr(key)))

def XXX__iter__(self):
yield True
yield False


COLORS = [WHITE, BLACK] = [True, False]

PIECE_TYPES = [NONE, PAWN, KNIGHT, BISHOP, ROOK, QUEEN, KING] = range(7)
Expand Down Expand Up @@ -793,7 +767,7 @@ def __init__(self, fen=None):
self.pseudo_legal_moves = PseudoLegalMoveGenerator(self)
self.legal_moves = LegalMoveGenerator(self)

self.occupied_co = _Occupancy()
self.occupied_co = [BB_VOID, BB_VOID]

self.attacks_valid = False
self.attacks_from = collections.defaultdict(int)
Expand Down

0 comments on commit d9b2dba

Please sign in to comment.