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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958
|
Author: Reiner Herrmann <reiner@reiner-h.de>
Description: Port to Python3
Bug-Debian: https://bugs.debian.org/912513
--- a/monsterz.py
+++ b/monsterz.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@@ -18,6 +18,7 @@
from sys import argv, exit, platform
from os.path import join, isdir, isfile, dirname, expanduser
from os import write, mkdir, getenv
+from functools import cmp_to_key
# String constants
VERSION = '0.7.1'
@@ -117,12 +118,12 @@
r, g, b = p
M = int(max(r, g, b))
m = int(min(r, g, b))
- val = (2 * M + r + g + b) / 5
- p[0] = (val + r) / 2
- p[1] = (val + g) / 2
- p[2] = (val + b) / 2
+ val = (2 * M + r + g + b) // 5
+ p[0] = (val + r) // 2
+ p[1] = (val + g) // 2
+ p[2] = (val + b) // 2
if alpha[y][x] >= 250:
- alpha[y][x] = 255 - (M - m) * 3 / 4
+ alpha[y][x] = 255 - (M - m) * 3 // 4
del pixels
del alpha
surf.unlock()
@@ -141,11 +142,11 @@
r, g, b = p
M = int(max(r, g, b))
m = int(min(r, g, b))
- p[0] = (m + r) / 2
- p[1] = (m + g) / 2
- p[2] = (m + b) / 2
+ p[0] = (m + r) // 2
+ p[1] = (m + g) // 2
+ p[2] = (m + b) // 2
if alpha[y][x] >= 250:
- alpha[y][x] = 255 - M * 2 / 3
+ alpha[y][x] = 255 - M * 2 // 3
del pixels
del alpha
surf.unlock()
@@ -232,12 +233,12 @@
file.close()
def get(self, key):
- if not self.config.has_key(key):
+ if key not in self.config:
return None
return self.config[key]
def set(self, key, value):
- if not self.config.has_key(key):
+ if key not in self.config:
return
self.config[key] = value
@@ -255,15 +256,15 @@
pass
# Add dummy scores to make sure our score list is full
for game in ['CLASSIC']:
- if not self.scores.has_key(game):
+ if game not in self.scores:
self.scores[game] = []
for x in range(20): self._add_score(game, 'NOBODY', 0, 1)
def _add_score(self, game, name, score, level):
- if not self.scores.has_key(game):
+ if game not in self.scores:
self.scores[game] = []
self.scores[game].append((name, score, level))
- self.scores[game].sort(compare_scores)
+ self.scores[game].sort(key=cmp_to_key(compare_scores))
self.scores[game] = self.scores[game][0:19]
def new_score(self, game, score, level):
@@ -278,7 +279,7 @@
msg += type + ':' + name + ':' + str(score) + ':' + str(level)
msg += '\n'
if self.outfd is not None:
- write(self.outfd, msg + '\n')
+ write(self.outfd, (msg + '\n').encode())
else:
try:
file = open(self.scorefile, 'w')
@@ -300,7 +301,7 @@
self.background = pygame.image.load(join(dir, 'graphics', 'background.png')).convert()
self.board = pygame.image.load(join(dir, 'graphics', 'board.png')).convert()
self.logo = pygame.image.load(join(dir, 'graphics', 'logo.png')).convert_alpha()
- self.orig_size = w / 5
+ self.orig_size = w // 5
self.normal = [None] * ITEMS
self.blink = [None] * ITEMS
self.tiny = [None] * ITEMS
@@ -330,8 +331,8 @@
# Create sprites
for i in range(ITEMS):
self.normal[i] = scale(tile_at(0, i + 5), (t, t))
- self.tiny[i] = scale(tile_at(0, i + 5), (t * 3 / 4, t * 3 / 4))
- self.shaded[i] = scale(tile_at(3, i + 5), (t * 3 / 4, t * 3 / 4))
+ self.tiny[i] = scale(tile_at(0, i + 5), (t * 3 // 4, t * 3 // 4))
+ self.shaded[i] = scale(tile_at(3, i + 5), (t * 3 // 4, t * 3 // 4))
semi_grayscale(self.shaded[i])
self.blink[i] = scale(tile_at(1, i + 5), (t, t))
self.surprise[i] = scale(tile_at(2, i + 5), (t, t))
@@ -340,15 +341,15 @@
#tmp = tile_at(1, 0).copy() # marche pas !
tmp = scale(tile_at(1, 0), (t, t)) # marche...
mini = tile_at(0, i + 5)
- mini = scale(mini, (t * 7 / 8 - 1, t * 7 / 8 - 1))
- tmp.blit(mini, (s / 16, s / 16))
+ mini = scale(mini, (t * 7 // 8 - 1, t * 7 // 8 - 1))
+ tmp.blit(mini, (s // 16, s // 16))
self.special[i] = scale(tmp, (t, t))
- self.led_off = scale(self.tiles.subsurface((3 * s, 0, s / 2, s / 2)), (t / 2, t / 2))
- self.led_on = scale(self.tiles.subsurface((3 * s + s / 2, 0, s / 2, s / 2)), (t / 2, t / 2))
- self.led_more = scale(self.tiles.subsurface((3 * s, s / 2, s / 2, s / 2)), (t / 2, t / 2))
- self.led_less = scale(self.tiles.subsurface((3 * s + s / 2, s / 2, s / 2, s / 2)), (t / 2, t / 2))
- self.eye = scale(tile_at(2, 0), (t * 3 / 4, t * 3 / 4))
- self.shadeye = scale(tile_at(2, 0), (t * 3 / 4, t * 3 / 4))
+ self.led_off = scale(self.tiles.subsurface((3 * s, 0, s // 2, s // 2)), (t // 2, t // 2))
+ self.led_on = scale(self.tiles.subsurface((3 * s + s // 2, 0, s // 2, s // 2)), (t // 2, t // 2))
+ self.led_more = scale(self.tiles.subsurface((3 * s, s // 2, s // 2, s // 2)), (t // 2, t // 2))
+ self.led_less = scale(self.tiles.subsurface((3 * s + s // 2, s // 2, s // 2, s // 2)), (t // 2, t // 2))
+ self.eye = scale(tile_at(2, 0), (t * 3 // 4, t * 3 // 4))
+ self.shadeye = scale(tile_at(2, 0), (t * 3 // 4, t * 3 // 4))
semi_transp(self.shadeye)
self.arrow = tile_at(4, 0)
self.selector = scale(tile_at(0, 0), (t, t))
@@ -381,7 +382,7 @@
def screen2board(self, coord):
x, y = coord
- return ((x - 24) / ITEM_SIZE, (y - 24) / ITEM_SIZE)
+ return ((x - 24) // ITEM_SIZE, (y - 24) // ITEM_SIZE)
class Sprite:
def __init__(self, surf, coord):
@@ -412,7 +413,8 @@
def blit(self, surf, coords):
self.background.blit(surf, coords)
- def blit_board(self, (x1, y1, x2, y2)):
+ def blit_board(self, coords):
+ (x1, y1, x2, y2) = coords
x1, y1 = x1 * ITEM_SIZE, y1 * ITEM_SIZE
x2, y2 = x2 * ITEM_SIZE - x1, y2 * ITEM_SIZE - y1
surf = data.board.subsurface((x1, y1, x2, y2))
@@ -468,16 +470,16 @@
self.cache.append((m, s, c, t))
return t
font = pygame.font.Font(None, size * 2)
- delta = 2 + size / 8
+ delta = 2 + size // 8
black = font.render(msg, 2, (0, 0, 0))
w, h = black.get_size()
text = pygame.Surface((w + delta, h + delta)).convert_alpha()
text.fill((0, 0, 0, 0))
for x, y in [(5, 5), (6, 3), (5, 1), (3, 0),
(1, 1), (0, 3), (1, 5), (3, 6)]:
- text.blit(black, (x * delta / 6, y * delta / 6))
+ text.blit(black, (x * delta // 6, y * delta // 6))
white = font.render(msg, 2, color)
- text.blit(white, (delta / 2, delta / 2))
+ text.blit(white, (delta // 2, delta // 2))
text = pygame.transform.rotozoom(text, 0.0, 0.5)
self.cache.append((msg, size, color, text))
if len(self.cache) > self.size:
@@ -506,7 +508,7 @@
self.win_timer = 0
self.warning_timer = 0
self.switch_timer = 0
- self.level_timer = SCROLL_DELAY / 2
+ self.level_timer = SCROLL_DELAY // 2
self.board_timer = 0
self.missed = False
self.check_moves = False
@@ -541,11 +543,11 @@
#self.board[randint(3, 4)][0] = ITEM_METAL
def fill_board(self):
- for y in xrange(BOARD_HEIGHT - 1, -1, -1):
- for x in xrange(BOARD_WIDTH - 1, -1, -1):
+ for y in range(BOARD_HEIGHT - 1, -1, -1):
+ for x in range(BOARD_WIDTH - 1, -1, -1):
if self.board[x][y] != ITEM_NONE:
continue
- for y2 in xrange(y - 1, -1, -1):
+ for y2 in range(y - 1, -1, -1):
if self.board[x][y2] != ITEM_NONE:
self.board[x][y] = self.board[x][y2]
self.extra_offset[x][y] = (0, ITEM_SIZE * (y2 - y))
@@ -697,7 +699,7 @@
system.blit(data.board, (24, 24))
# Have a random piece blink
c = randint(0, BOARD_WIDTH - 1), randint(0, BOARD_HEIGHT - 1)
- if randint(0, 5) is 0 and not self.blink_list.has_key(c):
+ if randint(0, 5) == 0 and c not in self.blink_list:
self.blink_list[c] = 5
# Handle special scrolling cases
if self.level_timer:
@@ -706,14 +708,14 @@
timer = self.board_timer
else:
timer = 0
- if timer > SCROLL_DELAY / 2:
+ if timer > SCROLL_DELAY // 2:
global_xoff = 0
yoff = (SCROLL_DELAY - timer) * (SCROLL_DELAY - timer)
- global_yoff = yoff * 50 * 50 / SCROLL_DELAY / SCROLL_DELAY
+ global_yoff = yoff * 50 * 50 // SCROLL_DELAY // SCROLL_DELAY
elif timer > 0:
global_xoff = 0
yoff = - timer * timer
- global_yoff = yoff * 50 * 50 / SCROLL_DELAY / SCROLL_DELAY
+ global_yoff = yoff * 50 * 50 // SCROLL_DELAY // SCROLL_DELAY
else:
global_xoff = 0
global_yoff = 0
@@ -739,15 +741,15 @@
xoff, yoff = self.extra_offset[i][j]
if self.lost_timer:
d = LOST_DELAY - self.lost_timer
- xoff += (i * 2 - 7) * 4 * d / LOST_DELAY
- yoff += (j * 2 - 7) * 4 * d / LOST_DELAY
- xoff += (j * 2 - 7) * 4 * d / LOST_DELAY
- yoff += (-i * 2 + 7) * 4 * d / LOST_DELAY
+ xoff += (i * 2 - 7) * 4 * d // LOST_DELAY
+ yoff += (j * 2 - 7) * 4 * d // LOST_DELAY
+ xoff += (j * 2 - 7) * 4 * d // LOST_DELAY
+ yoff += (-i * 2 + 7) * 4 * d // LOST_DELAY
xoff += (randint(0, d) - randint(0, d))
yoff += (randint(0, d) - randint(0, d))
self.extra_offset[i][j] = xoff, yoff
elif yoff and self.win_timer:
- yoff = yoff * (self.win_timer - 1) / (WIN_DELAY * 2 / 3)
+ yoff = yoff * (self.win_timer - 1) // (WIN_DELAY * 2 // 3)
self.extra_offset[i][j] = xoff, yoff
xoff += global_xoff
yoff += global_yoff
@@ -758,20 +760,20 @@
shape = data.metal
elif n >= ITEM_PUZZLE:
shape = data.puzzle[puzzlevels[self.level - 1][2]][n - ITEM_PUZZLE]
- elif self.level_timer and self.level_timer < SCROLL_DELAY / 2:
+ elif self.level_timer and self.level_timer < SCROLL_DELAY // 2:
shape = data.blink[n]
elif (i, j) in self.surprised_list \
- or self.board_timer > SCROLL_DELAY / 2 \
- or self.level_timer > SCROLL_DELAY / 2:
+ or self.board_timer > SCROLL_DELAY // 2 \
+ or self.level_timer > SCROLL_DELAY // 2:
shape = data.surprise[n]
elif (i, j) in self.disappear_list:
shape = data.exploded[n]
elif n == self.angry_items:
shape = data.angry[n]
- elif self.blink_list.has_key((i, j)):
+ elif (i, j) in self.blink_list:
shape = data.blink[n]
self.blink_list[i, j] -= 1
- if self.blink_list[i, j] is 0: del self.blink_list[i, j]
+ if self.blink_list[i, j] == 0: del self.blink_list[i, j]
else:
shape = data.normal[n]
# Remember the selector coordinates
@@ -785,7 +787,8 @@
if self.select:
system.blit(data.selector, select_coord)
- def piece_draw(self, sprite, (x, y)):
+ def piece_draw(self, sprite, pos):
+ (x, y) = pos
width = ITEM_SIZE
crop = sprite.subsurface
# Constrain X
@@ -820,7 +823,7 @@
# Draw timebar
timebar = pygame.Surface((406, 32)).convert_alpha()
timebar.fill((0, 0, 0, 155))
- w = 406 * self.time / 2000000
+ w = 406 * self.time // 2000000
if w > 0:
if self.warning_timer:
ratio = 1.0 * abs(2 * self.warning_timer - WARNING_DELAY) \
@@ -844,14 +847,14 @@
else:
for x in range(4):
for y in range(len(alpha[x])):
- alpha[x][y] = alpha[x][y] * x / 4
+ alpha[x][y] = alpha[x][y] * x // 4
for y in range(len(alpha[406 - x - 1])):
- alpha[406 - x - 1][y] = alpha[406 - x - 1][y] * x / 4
+ alpha[406 - x - 1][y] = alpha[406 - x - 1][y] * x // 4
for col in alpha:
l = len(col)
for y in range(4):
- col[y] = col[y] * y / 4
- col[l - y - 1] = col[l - y - 1] * y / 4
+ col[y] = col[y] * y // 4
+ col[l - y - 1] = col[l - y - 1] * y // 4
del col
del alpha
timebar.unlock()
@@ -860,7 +863,7 @@
# Print play again message
text = fonter.render('GAME OVER', 80)
w, h = text.get_rect().size
- system.blit(text, (24 + 192 - w / 2, 24 + 192 - h / 2))
+ system.blit(text, (24 + 192 - w // 2, 24 + 192 - h // 2))
if self.score < 5000:
msg = 'YUO = TEH L0SER'
elif self.score < 15000:
@@ -871,13 +874,13 @@
msg = 'ZOMFG!!!111!!! YUO PWND!!!%$#@%@#'
text = fonter.render(msg, 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 192 - w / 2, 24 + 240 - h / 2))
+ system.blit(text, (24 + 192 - w // 2, 24 + 240 - h // 2))
elif self.paused:
# Draw pause message
system.blit(self.pause_bitmap, (72, 24))
text = fonter.render('PAUSED', 120)
w, h = text.get_rect().size
- system.blit(text, (24 + 192 - w / 2, 24 + 336 - h / 2))
+ system.blit(text, (24 + 192 - w // 2, 24 + 336 - h // 2))
elif self.splash:
if self.type == GAME_TRAINING:
msg = 'TRAINING'
@@ -885,7 +888,7 @@
msg = 'LEVEL ' + str(self.level)
text = fonter.render(msg, 60)
w, h = text.get_rect().size
- system.blit(text, (24 + 192 - w / 2, 24 + 144 - h / 2))
+ system.blit(text, (24 + 192 - w // 2, 24 + 144 - h // 2))
if self.needed[0]:
msg = 'MONSTERS NEEDED: ' + str(self.needed[0])
elif self.type == GAME_PUZZLE:
@@ -894,12 +897,12 @@
msg = 'UNLIMITED LEVEL'
text = fonter.render(msg, 40)
w, h = text.get_rect().size
- system.blit(text, (24 + 192 - w / 2, 24 + 240 - h / 2))
+ system.blit(text, (24 + 192 - w // 2, 24 + 240 - h // 2))
if self.lucky != -1:
text = fonter.render('LUCKY MONSTER:', 40)
w, h = text.get_rect().size
- system.blit(text, (192 - w / 2 - 8, 24 + 288 - h / 2))
- system.blit(data.normal[self.lucky], (192 + w / 2, 288))
+ system.blit(text, (192 - w // 2 - 8, 24 + 288 - h // 2))
+ system.blit(data.normal[self.lucky], (192 + w // 2, 288))
text = fonter.render(ITEM_NAMES[self.lucky],20)
wn, hn = text.get_rect().size
system.blit(text, (192 + w/2 - wn/2 + ITEM_SIZE/2,
@@ -908,18 +911,18 @@
# Draw pieces
self.board_draw()
# Print new level stuff
- if self.level_timer > SCROLL_DELAY / 2:
+ if self.level_timer > SCROLL_DELAY // 2:
if self.type == GAME_PUZZLE:
text = fonter.render('COMPLETED!', 80)
else:
text = fonter.render('LEVEL UP!', 80)
w, h = text.get_rect().size
- system.blit(text, (24 + 192 - w / 2, 24 + 192 - h / 2))
+ system.blit(text, (24 + 192 - w // 2, 24 + 192 - h // 2))
# When no more moves are possible
- if self.board_timer > SCROLL_DELAY / 2:
+ if self.board_timer > SCROLL_DELAY // 2:
text = fonter.render('NO MORE MOVES!', 60)
w, h = text.get_rect().size
- system.blit(text, (24 + 192 - w / 2, 24 + 192 - h / 2))
+ system.blit(text, (24 + 192 - w // 2, 24 + 192 - h // 2))
# Print bonus
for b in self.bonus_list:
if b[2]:
@@ -928,7 +931,7 @@
text = fonter.render(str(b[1]), 36)
w, h = text.get_rect().size
x, y = data.board2screen(b[0])
- system.blit(text, (x + 24 - w / 2, y + 24 - h / 2))
+ system.blit(text, (x + 24 - w // 2, y + 24 - h // 2))
# Print hint arrow
if self.show_move:
lookup = [0, 1, 5, 16, 27, 31, 32, 31, 27, 16, 5, 1]
@@ -936,8 +939,8 @@
x1, y1 = data.board2screen(src)
x2, y2 = data.board2screen(dst)
delta = lookup[monsterz.timer % 12]
- x = -32 + (x1 * delta + x2 * (32 - delta)) / 32
- y = 32 + (y1 * delta + y2 * (32 - delta)) / 32
+ x = -32 + (x1 * delta + x2 * (32 - delta)) // 32
+ y = 32 + (y1 * delta + y2 * (32 - delta)) // 32
system.blit(data.arrow, (x, y))
break # Only show one move
# Print score
@@ -946,7 +949,7 @@
system.blit(text, (624 - w, 10))
# Print done/needed
for i in range(self.population):
- x = 440 + i / 4 * 90
+ x = 440 + i // 4 * 90
y = 64 + (i % 4) * 38
if self.done[i] >= self.needed[i]:
surf = data.tiny[i]
@@ -972,15 +975,15 @@
led, color = data.led_on, (255, 255, 255)
else:
led, color = data.led_off, (180, 150, 127)
- c = map(lambda a, b: b - (b - a) * self.psat[0] / 255, r, color)
+ c = list(map(lambda a, b: b - (b - a) * self.psat[0] // 255, r, color))
system.blit(led, (440, 298))
system.blit(fonter.render('PAUSE', 30, c), (470, 296))
color = (180, 150, 127)
- c = map(lambda a, b: b - (b - a) * self.psat[1] / 255, r, color)
+ c = list(map(lambda a, b: b - (b - a) * self.psat[1] // 255, r, color))
system.blit(fonter.render('ABORT', 30, c), (470, 326))
for x in range(2):
if self.psat[x]:
- self.psat[x] = self.psat[x] * 8 / 10
+ self.psat[x] = self.psat[x] * 8 // 10
def pause(self):
# TODO: prevent cheating by not allowing less than 1 second
@@ -998,7 +1001,7 @@
def update(self):
ticks = pygame.time.get_ticks()
- delta = (ticks - self.oldticks) * 450 / (12 - self.speed)
+ delta = (ticks - self.oldticks) * 450 // (12 - self.speed)
self.oldticks = ticks
# If paused, do nothing
if self.paused:
@@ -1008,16 +1011,16 @@
# Resolve winning moves and chain reactions
if self.board_timer:
self.board_timer -= 1
- if self.board_timer is SCROLL_DELAY / 2:
+ if self.board_timer is SCROLL_DELAY // 2:
self.new_board()
- elif self.board_timer is 0:
+ elif self.board_timer == 0:
system.play('boing')
self.check_moves = True # Need to check again
return
if self.lost_timer: # FIXME: this is quite a mess...
if self.lost:
return # Continue forever
- if self.lost_timer is -1:
+ if self.lost_timer == -1:
if self.type == GAME_TRAINING:
settings.new_score('TRAINING', self.score, self.level)
elif self.type == GAME_CLASSIC:
@@ -1027,12 +1030,12 @@
self.lost = True
return
self.lost_timer -= 1
- if self.lost_timer is 0:
+ if self.lost_timer == 0:
self.lost_timer = -1
return
if self.switch_timer:
self.switch_timer -= 1
- if self.switch_timer is 0:
+ if self.switch_timer == 0:
x1, y1 = self.select
x2, y2 = self.switch
self.board[x1][y1], self.board[x2][y2] = self.board[x2][y2], self.board[x1][y1]
@@ -1053,7 +1056,7 @@
return
if self.level_timer:
self.level_timer -= 1
- if self.level_timer is SCROLL_DELAY / 2:
+ if self.level_timer is SCROLL_DELAY // 2:
self.level += 1
if self.type == GAME_PUZZLE:
if self.level > len(puzzlevels):
@@ -1061,7 +1064,7 @@
return
self.new_level()
self.splash = True
- elif self.level_timer is 0:
+ elif self.level_timer == 0:
system.play('boing')
self.blink_list = {}
self.check_moves = True
@@ -1073,7 +1076,7 @@
for w in self.wins:
for x, y in w:
self.surprised_list.append((x, y))
- elif self.win_timer is WIN_DELAY * 4 / 5:
+ elif self.win_timer is WIN_DELAY * 4 // 5:
system.play('pop')
self.scorebonus = 0
self.timebonus = 0
@@ -1094,10 +1097,10 @@
for x, y in w:
x2 += x
y2 += y
- self.bonus_list.append([(x2 / len(w), y2 / len(w)), points, lucky])
+ self.bonus_list.append([(x2 // len(w), y2 // len(w)), points, lucky])
self.disappear_list = self.surprised_list
self.surprised_list = []
- elif self.win_timer is WIN_DELAY * 3 / 5:
+ elif self.win_timer is WIN_DELAY * 3 // 5:
for x, y in self.disappear_list:
if self.board[x][y] != ITEM_NONE:
self.done[self.board[x][y]] += 1
@@ -1113,7 +1116,7 @@
self.angry_items = angry
self.disappear_list = []
self.bonus_list = []
- elif self.win_timer is WIN_DELAY * 2 / 5:
+ elif self.win_timer is WIN_DELAY * 2 // 5:
self.time += self.timebonus
if self.time > 2000000:
self.time = 2000000
@@ -1123,7 +1126,7 @@
self.eyes += 1
self.score += self.scorebonus
self.fill_board()
- elif self.win_timer is 0:
+ elif self.win_timer == 0:
system.play('boing')
self.wins = self.get_wins()
if self.wins:
@@ -1210,9 +1213,9 @@
self.will_play = move
min = self.done[color]
self.ai_timer = 15 - self.level
- if self.ai_timer is (15 - self.level) / 2:
+ if self.ai_timer is (15 - self.level) // 2:
self.clicks.append(self.will_play[0])
- elif self.ai_timer is 0:
+ elif self.ai_timer == 0:
self.clicks.append(self.will_play[1])
self.will_play = None
self.ai_timer -= 1
@@ -1306,9 +1309,9 @@
else:
for x in range(10):
for y in range(len(alpha[x])):
- alpha[x][y] = alpha[x][y] * x / 12
+ alpha[x][y] = alpha[x][y] * x // 12
for y in range(len(alpha[406 - x - 1])):
- alpha[406 - x - 1][y] = alpha[406 - x - 1][y] * x / 12
+ alpha[406 - x - 1][y] = alpha[406 - x - 1][y] * x // 12
del alpha
scroll.unlock()
system.blit(scroll, (13, 437))
@@ -1339,26 +1342,26 @@
led, color = data.led_on, (255, 255, 255)
else:
led, color = data.led_off, (180, 150, 127)
- c = map(lambda a, b: b - (b - a) * self.gsat[0] / 255, r, color)
+ c = list(map(lambda a, b: b - (b - a) * self.gsat[0] // 255, r, color))
system.blit(led, (440, 378))
system.blit(fonter.render('SOUND FX', 30, c), (470, 376))
if settings.get('music'):
led, color = data.led_on, (255, 255, 255)
else:
led, color = data.led_off, (180, 150, 127)
- c = map(lambda a, b: b - (b - a) * self.gsat[1] / 255, r, color)
+ c = list(map(lambda a, b: b - (b - a) * self.gsat[1] // 255, r, color))
system.blit(led, (440, 408))
system.blit(fonter.render('MUSIC', 30, c), (470, 406))
if settings.get('fullscreen'):
led, color = data.led_on, (255, 255, 255)
else:
led, color = data.led_off, (180, 150, 127)
- c = map(lambda a, b: b - (b - a) * self.gsat[2] / 255, r, color)
+ c = list(map(lambda a, b: b - (b - a) * self.gsat[2] // 255, r, color))
system.blit(led, (440, 438))
system.blit(fonter.render('FULLSCREEN', 30, c), (470, 436))
for x in range(3):
if self.gsat[x]:
- self.gsat[x] = self.gsat[x] * 8 / 10
+ self.gsat[x] = self.gsat[x] * 8 // 10
def generic_event(self, event):
if event.type == QUIT:
@@ -1443,7 +1446,7 @@
self.marea = marea
# Print logo and menu
w, h = data.logo.get_size()
- system.blit(data.logo, (24 + 192 - w / 2, 24 + 96 - h / 2))
+ system.blit(data.logo, (24 + 192 - w // 2, 24 + 96 - h // 2))
self.wanderer_draw()
for x in range(4):
if self.msat[x] > 180:
@@ -1453,12 +1456,12 @@
else:
monster = data.blink[shapes[x]]
system.blit(monster, data.board2screen((1, 4 + x)))
- c = map(lambda a: 255 - (255 - a) * self.msat[x] / 255, colors[x])
+ c = list(map(lambda a: 255 - (255 - a) * self.msat[x] // 255, colors[x]))
text = fonter.render(messages[x], 48, c)
w, h = text.get_rect().size
- system.blit(text, (24 + 102, 24 + 216 + ITEM_SIZE * x - h / 2))
+ system.blit(text, (24 + 102, 24 + 216 + ITEM_SIZE * x - h // 2))
if self.msat[x]:
- self.msat[x] = self.msat[x] * 8 / 10
+ self.msat[x] = self.msat[x] * 8 // 10
# Handle events
for event in pygame.event.get():
if self.generic_event(event):
@@ -1525,32 +1528,32 @@
# Print menu
text = fonter.render('GAME TYPE', 60)
w, h = text.get_rect().size
- system.blit(text, (24 + 192 - w / 2, 24 + 24 - h / 2))
+ system.blit(text, (24 + 192 - w // 2, 24 + 24 - h // 2))
for i in range(4):
- c = map(lambda a: 255 - (255 - a) * self.nsat[i] / 255, [127, 0, 255])
+ c = list(map(lambda a: 255 - (255 - a) * self.nsat[i] // 255, [127, 0, 255]))
text = fonter.render(messages[i], 48, c)
w, h = text.get_rect().size
- system.blit(text, (24 + ITEM_SIZE * 4 - w / 2, 24 + 120 + ITEM_SIZE * i - h / 2))
+ system.blit(text, (24 + ITEM_SIZE * 4 - w // 2, 24 + 120 + ITEM_SIZE * i - h // 2))
if self.nsat[i]:
- self.nsat[i] = self.nsat[i] * 8 / 10
+ self.nsat[i] = self.nsat[i] * 8 // 10
for i in range(4, 8):
- c = map(lambda a: 255 - (255 - a) * self.nsat[i] / 255, [127, 0, 255])
+ c = list(map(lambda a: 255 - (255 - a) * self.nsat[i] // 255, [127, 0, 255]))
if i % 2:
img = data.led_more
x = 320
else:
img = data.led_less
x = 88
- y = 36 + ITEM_SIZE * (6 + (i - 4) / 2)
+ y = 36 + ITEM_SIZE * (6 + (i - 4) // 2)
system.blit(img, (x, y))
if self.nsat[i]:
- self.nsat[i] = self.nsat[i] * 8 / 10
+ self.nsat[i] = self.nsat[i] * 8 // 10
# Print wanted monsterz
for i in range(items):
- system.blit(data.normal[i], (24 + 96 + ITEM_SIZE * 3 * i / (items - 1), 24 + ITEM_SIZE * 6))
+ system.blit(data.normal[i], (24 + 96 + ITEM_SIZE * 3 * i // (items - 1), 24 + ITEM_SIZE * 6))
text = fonter.render('DIFFICULTY ' + str(difficulty), 36)
w, h = text.get_rect().size
- system.blit(text, (24 + 192 - w / 2, 24 + ITEM_SIZE * 7 + 24 - h / 2))
+ system.blit(text, (24 + 192 - w // 2, 24 + ITEM_SIZE * 7 + 24 - h // 2))
# Handle events
for event in pygame.event.get():
if self.generic_event(event):
@@ -1559,7 +1562,7 @@
system.play('whip')
self.status = STATUS_MENU
return
- elif event.type == MOUSEBUTTONDOWN and narea >= 10:
+ elif event.type == MOUSEBUTTONDOWN and narea is not None and narea >= 10:
system.play('whip')
if narea == ACTION_MOREMONSTERZ:
if items < 8:
@@ -1656,18 +1659,18 @@
# Title
text = fonter.render('INSTRUCTIONS (' + str(self.page) + ')', 60)
w, h = text.get_rect().size
- system.blit(text, (24 + 192 - w / 2, 24 + 24 - h / 2))
+ system.blit(text, (24 + 192 - w // 2, 24 + 24 - h // 2))
if self.page == 1:
# Explanation 1
text = fonter.render('SWAP ADJACENT MONSTERS TO CREATE', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 84 - h / 2))
+ system.blit(text, (24 + 6, 24 + 84 - h // 2))
text = fonter.render('ALIGNMENTS OF THREE OR MORE. NEW', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 108 - h / 2))
+ system.blit(text, (24 + 6, 24 + 108 - h // 2))
text = fonter.render('MONSTERS WILL FILL THE HOLES.', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 132 - h / 2))
+ system.blit(text, (24 + 6, 24 + 132 - h // 2))
# Iter 1
system.blit_board((0, 3, 2, 7))
system.blit(data.normal[2], data.board2screen((0, 3)))
@@ -1704,22 +1707,22 @@
text = fonter.render('10', 36)
w, h = text.get_rect().size
x, y = data.board2screen((7, 4))
- system.blit(text, (x + 24 - w / 2, y + 24 - h / 2))
+ system.blit(text, (x + 24 - w // 2, y + 24 - h // 2))
# Explanation 2
text = fonter.render('CREATE CHAIN REACTIONS TO GET TWICE', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 348 - h / 2))
+ system.blit(text, (24 + 6, 24 + 348 - h // 2))
text = fonter.render('AS MANY POINTS, THEN 4x, 8x ETC.', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 372 - h / 2))
+ system.blit(text, (24 + 6, 24 + 372 - h // 2))
elif self.page == 2:
# Explanation 1
text = fonter.render('THE LUCKY MONSTER EARNS YOU TWICE', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 108 - h / 2))
+ system.blit(text, (24 + 6, 24 + 108 - h // 2))
text = fonter.render('AS MANY POINTS AS OTHER MONSTERS.', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 132 - h / 2))
+ system.blit(text, (24 + 6, 24 + 132 - h // 2))
shape = data.special[self.timer % 7]
# Print done/needed
system.blit_board((0, 3, 4, 5))
@@ -1743,15 +1746,15 @@
text = fonter.render('140', 48, rainbow[monsterz.timer % 6])
w, h = text.get_rect().size
x, y = data.board2screen((2, 6))
- system.blit(text, (x + 24 - w / 2, y + 24 - h / 2))
+ system.blit(text, (x + 24 - w // 2, y + 24 - h // 2))
text = fonter.render('70', 36)
w, h = text.get_rect().size
x, y = data.board2screen((1, 7))
- system.blit(text, (x + 24 - w / 2, y + 24 - h / 2))
+ system.blit(text, (x + 24 - w // 2, y + 24 - h // 2))
for i in range(4):
surf = data.tiny[i + 1]
count = 3 + i * 2
- x = 24 + 240 + 4 + i / 2 * 70
+ x = 24 + 240 + 4 + i // 2 * 70
y = 172 + (i % 2) * 38
for dummy in range(2):
system.blit(surf, (x, y))
@@ -1768,13 +1771,13 @@
# Explanation 1
text = fonter.render('YOU CAN ALWAYS PERFORM A VALID MOVE.', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 84 - h / 2))
+ system.blit(text, (24 + 6, 24 + 84 - h // 2))
text = fonter.render('WHEN NO MORE MOVES ARE POSSIBLE, YOU', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 108 - h / 2))
+ system.blit(text, (24 + 6, 24 + 108 - h // 2))
text = fonter.render('GET A COMPLETE NEW BOARD.', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 132 - h / 2))
+ system.blit(text, (24 + 6, 24 + 132 - h // 2))
# Surprised
system.blit_board((0, 3, 8, 5))
for x in range(8):
@@ -1782,29 +1785,29 @@
system.blit(data.surprise[(x * 7) % 8], data.board2screen((x, 4)))
text = fonter.render('NO MORE MOVES!', 60)
w, h = text.get_rect().size
- system.blit(text, (24 + 192 - w / 2, 24 + 192 - h / 2))
+ system.blit(text, (24 + 192 - w // 2, 24 + 192 - h // 2))
# Explanation 2
text = fonter.render('USE THE EYE TO FIND WHERE TO PLAY.', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6 + 48, 24 + 300 - h / 2))
+ system.blit(text, (24 + 6 + 48, 24 + 300 - h // 2))
text = fonter.render('EACH 10,000 POINTS YOU GET A NEW', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6 + 48, 24 + 324 - h / 2))
+ system.blit(text, (24 + 6 + 48, 24 + 324 - h // 2))
text = fonter.render('EYE. YOU CAN\'T HAVE MORE THAN 3.', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6 + 48, 24 + 348 - h / 2))
+ system.blit(text, (24 + 6 + 48, 24 + 348 - h // 2))
system.blit(data.eye, (24 + 6, 24 + 306))
elif self.page == 4:
# Explanation 1
text = fonter.render('WHEN ONLY ONE KIND OF MONSTER IS', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 84 - h / 2))
+ system.blit(text, (24 + 6, 24 + 84 - h // 2))
text = fonter.render('NEEDED TO FINISH THE LEVEL, MONSTERS', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 108 - h / 2))
+ system.blit(text, (24 + 6, 24 + 108 - h // 2))
text = fonter.render('OF THAT KIND GET AN ANGRY FACE.', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 132 - h / 2))
+ system.blit(text, (24 + 6, 24 + 132 - h // 2))
# Print done/needed
system.blit_board((0, 3, 4, 5))
for i in range(4):
@@ -1816,7 +1819,7 @@
big = data.angry[i + 4]
system.blit(big, data.board2screen((i, 3 + (i % 2))))
system.blit(big, data.board2screen(((i + 2) % 4, 3 + ((i + 1) % 2))))
- x = 24 + 240 + 4 + i / 2 * 70
+ x = 24 + 240 + 4 + i // 2 * 70
y = 172 + (i % 2) * 38
system.blit(surf, (x, y))
text = fonter.render(str(i * 3), 36)
@@ -1824,10 +1827,10 @@
# Explanation 2
text = fonter.render('CLICK ON THE BONUS TO REMOVE ALL', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 252 - h / 2))
+ system.blit(text, (24 + 6, 24 + 252 - h // 2))
text = fonter.render('MONSTERS OF A RANDOM KIND.', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 276 - h / 2))
+ system.blit(text, (24 + 6, 24 + 276 - h // 2))
shape = data.special[self.timer % 7]
# Iter 1
system.blit_board((0, 6, 3, 8))
@@ -1848,22 +1851,22 @@
text = fonter.render('10', 36)
w, h = text.get_rect().size
x, y = data.board2screen((4, 7))
- system.blit(text, (x + 24 - w / 2, y + 24 - h / 2))
+ system.blit(text, (x + 24 - w // 2, y + 24 - h // 2))
x, y = data.board2screen((5, 6))
- system.blit(text, (x + 24 - w / 2, y + 24 - h / 2))
+ system.blit(text, (x + 24 - w // 2, y + 24 - h // 2))
x, y = data.board2screen((6, 6))
- system.blit(text, (x + 24 - w / 2, y + 24 - h / 2))
+ system.blit(text, (x + 24 - w // 2, y + 24 - h // 2))
elif self.page == 5:
# Explanation 1
text = fonter.render('IN PUZZLE MODE, PUT TOGETHER THE', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 84 - h / 2))
+ system.blit(text, (24 + 6, 24 + 84 - h // 2))
text = fonter.render('PUZZLE BY MOVING PIECES AROUND. BE', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 108 - h / 2))
+ system.blit(text, (24 + 6, 24 + 108 - h // 2))
text = fonter.render('CAREFUL NOT TO GET STUCK!', 24)
w, h = text.get_rect().size
- system.blit(text, (24 + 6, 24 + 132 - h / 2))
+ system.blit(text, (24 + 6, 24 + 132 - h // 2))
# Iter 1
system.blit_board((0, 3, 2, 8))
system.blit(data.normal[2], data.board2screen((0, 3)))
@@ -1922,19 +1925,19 @@
self.copyright_draw()
text = fonter.render('HIGH SCORES', 60)
w, h = text.get_rect().size
- system.blit(text, (24 + 192 - w / 2, 24 + 24 - h / 2))
+ system.blit(text, (24 + 192 - w // 2, 24 + 24 - h // 2))
# Print our list
for x in range(10):
name, score, level = settings.scores['CLASSIC'][x]
text = fonter.render(str(x + 1) + '. ' + name.upper(), 32)
w, h = text.get_rect().size
- system.blit(text, (24 + 24, 24 + 72 + 32 * x - h / 2))
+ system.blit(text, (24 + 24, 24 + 72 + 32 * x - h // 2))
text = fonter.render(str(score), 32)
w, h = text.get_rect().size
- system.blit(text, (24 + 324 - w, 24 + 72 + 32 * x - h / 2))
+ system.blit(text, (24 + 324 - w, 24 + 72 + 32 * x - h // 2))
text = fonter.render(str(level), 32)
w, h = text.get_rect().size
- system.blit(text, (24 + 360 - w, 24 + 72 + 32 * x - h / 2))
+ system.blit(text, (24 + 360 - w, 24 + 72 + 32 * x - h // 2))
# Handle events
for event in pygame.event.get():
if self.generic_event(event):
@@ -1949,39 +1952,39 @@
return
def version():
- print 'monsterz ' + VERSION
- print 'Written by Sam Hocevar, music by MenTaLguY, sound effects by Sun Microsystems,'
- print 'Inc., Michael Speck, David White and the Battle for Wesnoth project, Mike'
- print 'Kershaw and Sam Hocevar.'
- print
- print 'Copyright (C) 2005, 2006 Sam Hocevar <sam@zoy.org>'
- print ' (C) 1998 MenTaLguY <mental@rydia.net>'
- print ' (C) 2002, 2005 Sun Microsystems, Inc.'
- print ' (C) Michael Speck <kulkanie@gmx.net>'
- print ' (C) 2003 by David White <davidnwhite@optusnet.com.au> and the'
- print ' Battle for Wesnoth project'
- print ' (C) Mike Kershaw <dragorn@kismetwireless.net>'
-
- print 'This program is free software; you can redistribute it and/or modify it under'
- print 'the terms of the Do What The Fuck You Want To Public License, Version 2, as'
- print 'published by Sam Hocevar. See http://sam.zoy.org/wtfpl/ for more details.'
- print 'The sound effects are released under their own licences: applause.wav and'
- print 'pop.wav are covered by the LGPL, the others are covered by the GPL.'
+ print('monsterz ' + VERSION)
+ print('Written by Sam Hocevar, music by MenTaLguY, sound effects by Sun Microsystems,')
+ print('Inc., Michael Speck, David White and the Battle for Wesnoth project, Mike')
+ print('Kershaw and Sam Hocevar.')
+ print()
+ print('Copyright (C) 2005, 2006 Sam Hocevar <sam@zoy.org>')
+ print(' (C) 1998 MenTaLguY <mental@rydia.net>')
+ print(' (C) 2002, 2005 Sun Microsystems, Inc.')
+ print(' (C) Michael Speck <kulkanie@gmx.net>')
+ print(' (C) 2003 by David White <davidnwhite@optusnet.com.au> and the')
+ print(' Battle for Wesnoth project')
+ print(' (C) Mike Kershaw <dragorn@kismetwireless.net>')
+
+ print('This program is free software; you can redistribute it and/or modify it under')
+ print('the terms of the Do What The Fuck You Want To Public License, Version 2, as')
+ print('published by Sam Hocevar. See http://sam.zoy.org/wtfpl/ for more details.')
+ print('The sound effects are released under their own licences: applause.wav and')
+ print('pop.wav are covered by the LGPL, the others are covered by the GPL.')
def usage():
- print 'Usage: monsterz [OPTION]...'
- print
- print 'Options'
- print ' -h, --help display this help and exit'
- print ' -v, --version display version information and exit'
- print ' -f, --fullscreen start in full screen mode'
- print ' -m, --nomusic disable music'
- print ' -s, --nosfx disable sound effects'
- print ' --outfd <fd> output scores to file descriptor <fd>'
- print ' --data <dir> set alternate data directory to <dir>'
- print ' --score <file> set score file to <file>'
- print
- print 'Report bugs or suggestions to <sam@zoy.org>.'
+ print('Usage: monsterz [OPTION]...')
+ print()
+ print('Options')
+ print(' -h, --help display this help and exit')
+ print(' -v, --version display version information and exit')
+ print(' -f, --fullscreen start in full screen mode')
+ print(' -m, --nomusic disable music')
+ print(' -s, --nosfx disable sound effects')
+ print(' --outfd <fd> output scores to file descriptor <fd>')
+ print(' --data <dir> set alternate data directory to <dir>')
+ print(' --score <file> set score file to <file>')
+ print()
+ print('Report bugs or suggestions to <sam@zoy.org>.')
def main():
from getopt import getopt, GetoptError
@@ -2013,7 +2016,7 @@
elif opt in ('--outfd'):
try:
outfd = int(arg)
- write(outfd, '\n')
+ write(outfd, b'\n')
except:
outfd = None
elif opt in ('--data'):
@@ -2028,7 +2031,7 @@
try:
data = Data(sharedir)
except:
- print argv[0] + ': could not open data from `' + sharedir + "'."
+ print(argv[0] + ': could not open data from `' + sharedir + "'.")
raise
fonter = Fonter()
monsterz = Monsterz()
|