1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Rename variable/s to make them more descriptive.

This commit is contained in:
Shlomi Fish 2020-05-25 14:06:08 +03:00
parent b311ff83fd
commit 12cf1e507f
4 changed files with 11 additions and 11 deletions

View file

@ -54,7 +54,7 @@ from pysollib.move import AUpdateStackMove
from pysollib.mygettext import _ from pysollib.mygettext import _
from pysollib.mygettext import ungettext from pysollib.mygettext import ungettext
from pysollib.pysolrandom import LCRandom31, PysolRandom, constructRandom, \ from pysollib.pysolrandom import LCRandom31, PysolRandom, constructRandom, \
random__long2str random__int2str
from pysollib.pysoltk import CURSOR_WATCH from pysollib.pysoltk import CURSOR_WATCH
from pysollib.pysoltk import Card from pysollib.pysoltk import Card
from pysollib.pysoltk import EVENT_HANDLED, EVENT_PROPAGATE from pysollib.pysoltk import EVENT_HANDLED, EVENT_PROPAGATE
@ -3200,7 +3200,7 @@ class Game(object):
game.version = version game.version = version
game.version_tuple = version_tuple game.version_tuple = version_tuple
# #
initial_seed = random__long2str(pload(int)) initial_seed = random__int2str(pload(int))
game.random = constructRandom(initial_seed) game.random = constructRandom(initial_seed)
state = pload() state = pload()
if not (isinstance(game.random, random2.Random) and if not (isinstance(game.random, random2.Random) and

View file

@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from pysollib.pysolrandom import random__str2long from pysollib.pysolrandom import random__str2int
from pysollib.settings import PACKAGE from pysollib.settings import PACKAGE
from pysollib.settings import VERSION, VERSION_TUPLE from pysollib.settings import VERSION, VERSION_TUPLE
@ -30,7 +30,7 @@ def pysolDumpGame(game_, p, bookmark=0):
p.dump(game_.GAME_VERSION) p.dump(game_.GAME_VERSION)
p.dump(game_.id) p.dump(game_.id)
# #
p.dump(random__str2long(game_.random.getSeedStr())) p.dump(random__str2int(game_.random.getSeedStr()))
p.dump(game_.random.getstate()) p.dump(game_.random.getstate())
# #
p.dump(len(game_.allstacks)) p.dump(len(game_.allstacks))

View file

@ -111,7 +111,7 @@ def constructRandom(s):
return pysol_cards.random.MTRandom(seed) return pysol_cards.random.MTRandom(seed)
def random__str2long(s): def random__str2int(s):
if s == 'Custom': if s == 'Custom':
return CUSTOM_BIT | MS_LONG_BIT return CUSTOM_BIT | MS_LONG_BIT
m = match_ms_deal_prefix(s) m = match_ms_deal_prefix(s)
@ -121,7 +121,7 @@ def random__str2long(s):
return int(s) return int(s)
def random__long2str(l): def random__int2str(l):
if ((l & MS_LONG_BIT) != 0): if ((l & MS_LONG_BIT) != 0):
if ((l & CUSTOM_BIT) != 0): if ((l & CUSTOM_BIT) != 0):
return 'Custom' return 'Custom'

View file

@ -59,7 +59,7 @@ from pysol_cards.random_base import RandomBase
# So the localpaths will be overrided. # So the localpaths will be overrided.
from pysollib.pysolrandom import constructRandom, \ from pysollib.pysolrandom import constructRandom, \
random__long2str, random__str2long random__int2str, random__str2int
# PySol imports # PySol imports
@ -151,20 +151,20 @@ QH 9H 9D 5S 7S 6C
''', 'Microsoft Deal #6E9 - extra long seed.') ''', 'Microsoft Deal #6E9 - extra long seed.')
inp = 'ms12345678' inp = 'ms12345678'
got = random__long2str(random__str2long(inp)) got = random__int2str(random__str2int(inp))
# TEST # TEST
self.assertEqual(got, inp, 'long2str ms roundtrip.') self.assertEqual(got, inp, 'long2str ms roundtrip.')
inp = '246007891097' inp = '246007891097'
got = random__long2str(random__str2long(inp)) got = random__int2str(random__str2int(inp))
# TEST # TEST
self.assertEqual(got, inp, 'long2str PySolFC roundtrip.') self.assertEqual(got, inp, 'long2str PySolFC roundtrip.')
proto_inp = '246007891097' proto_inp = '246007891097'
inp = random__str2long(proto_inp) inp = random__str2int(proto_inp)
got = random__str2long(random__long2str(inp)) got = random__str2int(random__int2str(inp))
# TEST # TEST
self.assertEqual(got, inp, 'str2long PySolFC roundtrip.') self.assertEqual(got, inp, 'str2long PySolFC roundtrip.')