projects
/
super-star-trek.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Correct sgn().
[super-star-trek.git]
/
sst.py
diff --git
a/sst.py
b/sst.py
index a9900528bda3b4edf03feb28b2a3decdaa8ce7ff..b8e7985dcc160f6881499a5833a544c5e77a5708 100755
(executable)
--- a/
sst.py
+++ b/
sst.py
@@
-38,7
+38,8
@@
def _(st):
# This is all encapsulated not just for logging but because someday
# we'll probably want to replace it with something like an LCG that
# This is all encapsulated not just for logging but because someday
# we'll probably want to replace it with something like an LCG that
-# can be forward-ported off Python.
+# can be forward-ported off Python. Thee only function we need is one to
+# return a variate uniformly-distributed over [0, 1).
import random
import random
@@
-118,8
+119,8
@@
class JumpOut(Exception):
class Coord:
def __init__(self, x=None, y=None):
class Coord:
def __init__(self, x=None, y=None):
- self.i = x
- self.j = y
+ self.i = x
# Row
+ self.j = y
# Column
def valid_quadrant(self):
return self.i >= 0 and self.i < GALSIZE and self.j >= 0 and self.j < GALSIZE
def valid_sector(self):
def valid_quadrant(self):
return self.i >= 0 and self.i < GALSIZE and self.j >= 0 and self.j < GALSIZE
def valid_sector(self):
@@
-163,12
+164,12
@@
class Coord:
if self.i == 0:
s.i = 0
elif s.i < 0:
if self.i == 0:
s.i = 0
elif s.i < 0:
- s.i =-1
+ s.i =
-1
else:
s.i = 1
if self.j == 0:
s.j = 0
else:
s.i = 1
if self.j == 0:
s.j = 0
- elif s.j < 0:
+ elif s
elf
.j < 0:
s.j = -1
else:
s.j = 1
s.j = -1
else:
s.j = 1