1
Fork 0

Update for Python3

This commit is contained in:
Alex Yatskov 2020-04-28 22:52:05 -07:00
parent 1c7bb3dc45
commit 9cfcddad52
2 changed files with 6 additions and 6 deletions

View File

@ -8,6 +8,6 @@ When running the application you can press the <kbd>N</kbd> key to start a new g
of the current piece, and <kbd>Space</kbd> drops it to the bottom of the well instantly. A small shadow tetrad at the
bottom of the well indicates where the current piece will fall.
Tetrys requires [Python 2.7](http://www.python.org/download/releases/2.7/) and [pygame](http://www.pygame.org/).
Tetrys requires [Python](http://www.python.org/) and [pygame](http://www.pygame.org/).
![](https://foosoft.net/projects/tetrys/img/tetrys.png)

View File

@ -35,8 +35,8 @@ class Tetrad:
layout = list()
mask = self.block_configs[self.config][1] >> (16 * self.rotation)
for bit in xrange(16):
position = bit % 4, bit / 4
for bit in range(16):
position = bit % 4, bit // 4
if mask & (1 << bit):
layout.append((self.position[0] + position[0], self.position[1] + position[1]))
@ -60,7 +60,7 @@ class Tetrad:
def centered(self, width):
return Tetrad((width / 2 - 2, 0), self.config, self.rotation)
return Tetrad((width // 2 - 2, 0), self.config, self.rotation)
@staticmethod
@ -113,8 +113,8 @@ class Board:
def render_blocks(self, surface):
for y in xrange(self.grid_dims[1]):
for x in xrange(self.grid_dims[0]):
for y in range(self.grid_dims[1]):
for x in range(self.grid_dims[0]):
self.render_block(surface, self.blocks[y][x], (x, y))