<!--StartFragment-->

class TetrisBoard(QFrame):

NUM_XBLOCK = 10

NUM_YBLOCK = 22

<!--[if !supportEmptyParas]--> <!--[endif]-->

def canMove(self, newPiece, newX, newY): #

for i in range(4):

x = newX + newPiece.x(i)

y = newY - newPiece.y(i)

if x < 0 or x >= TetrisBoard.NUM_XBLOCK or y < 0 or y >= TetrisBoard.NUM_YBLOCK:

return False # 프레임을 벗어나는 값일 경우 거짓을 반환

if self.shapeAt(x,y) != Tetrominoe.NoShape:

return False # Tetrominoe.NoShape -> 영행렬 기본형태를 나타내며, 위와 같이 영행렬 성분 값을 갖는 shape의 경우 거짓을 반환 (참조 1)

self.curPiece = newPiece

self.curX = newX

self.curY = newY

self.update()

return True # ???

<!--[if !supportEmptyParas]--> <!--[endif]-->

<!--StartFragment-->

(참조 1)

class Tetrominoe(object):

NoShape = 0

<!--[if !supportEmptyParas]--> <!--[endif]-->

class Shape(object):

coordsTable = (

((0, 0), (0, 0), (0, 0), (0, 0)),

((0, -1), (0, 0), (-1, 0), (-1, 1)),

((0, -1), (0, 0), (1, 0), (1, 1)),

((0, -1), (0, 0), (0, 1), (0, 2)),

((-1, 0), (0, 0), (1, 0), (0, 1)),

((0, 0), (1, 0), (0, 1), (1, 1)),

((-1, -1), (0, -1), (0, 0), (0, 1)),

((1, -1), (0, -1), (0, 0), (0, 1))

)