-
Notifications
You must be signed in to change notification settings - Fork 0
/
ghost_piece.py
executable file
·55 lines (37 loc) · 1.36 KB
/
ghost_piece.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 11 22:00:02 2012
ghost_piece: a wrapper for piece that inherits the class Piece
but has its own position
@author: tran
"""
from piece import Piece
class GhostPiece(Piece):
def __init__(self, piece):
"""Create a ghost of piece.
The ghost's initial position is that of piece, but you can
update the ghost's position without affecting the piece's position.
"""
Piece.__init__(self, piece.description)
self.piece = piece
self.position = None if piece.position is None else list(piece.position)
def __getattr__(self, attr):
return self.piece.__getattribute__(attr)
def chargingRegion(self):
return self.piece.chargingRegion()
def canCharge(self, other):
return self.piece.canCharge(other)
def transformingRegion(self):
return self.piece.transformingRegion()
def canTransform(self, other):
return self.piece.canTransform(other)
def transform(self):
return self.piece.transform()
def canMerge(self, other):
return self.piece.canMerge(other)
def merge(self, other):
return self.piece.merge(other)
def charge(self):
return self.piece.charge()
def multiChargeable(self):
return self.piece.multiChargeable()