import os, sys, math, curses, time, pickle, copy, gettext, getpass
import getopt, socket, locale
+import codecs
# This import only works on Unixes. The intention is to enable
# Ctrl-P, Ctrl-N, and friends in Cmd.
class randomizer:
# LCG PRNG parameters tested against
- # Knuth vol. 2. by the authors of ADVENT
+ # Knuth vol. 2. by the authors of ADVENT
LCG_A = 1093
LCG_C = 221587
LCG_M = 1048576
def random():
old_x = game.lcg_x
game.lcg_x = (randomizer.LCG_A * game.lcg_x + randomizer.LCG_C) % randomizer.LCG_M
- return old_x / randomizer.LCG_M;
+ return old_x / randomizer.LCG_M
@staticmethod
def withprob(p):
return self.roundtogrid() % QUADSIZE
def scatter(self):
s = Coord()
- s.i = self.i + rnd.range(-1, 2)
- s.j = self.j + rnd.range(-1, 2)
+ s.i = self.i + rnd.integer(-1, 2)
+ s.j = self.j + rnd.integer(-1, 2)
return s
def __str__(self):
if self.i is None or self.j is None:
def cgetline():
"Get a line of input."
if game.options & OPTION_CURSES:
- linein = curwnd.getstr() + "\n"
+ linein = codecs.decode(curwnd.getstr()) + "\n"
curwnd.refresh()
else:
if replayfp and not replayfp.closed:
'C':LIGHTRED,
'R':LIGHTRED,
'T':LIGHTRED,
+ '@':LIGHTGREEN,
+ 'P':LIGHTGREEN,
+ '?':MAGENTA,
}.get(game.quad[i][j], DEFAULT))
proutn("%c " % game.quad[i][j])
textcolor(DEFAULT)