mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
refactoring.
This commit is contained in:
parent
c825c3c6df
commit
033f99e4f2
3 changed files with 18 additions and 20 deletions
|
@ -100,7 +100,7 @@ class RoyalCotillion(Game):
|
||||||
x, y = l.XM + l.XS, self.height - l.YS
|
x, y = l.XM + l.XS, self.height - l.YS
|
||||||
s.talon = WasteTalonStack(x, y, self, max_rounds=1)
|
s.talon = WasteTalonStack(x, y, self, max_rounds=1)
|
||||||
l.createText(s.talon, "sw")
|
l.createText(s.talon, "sw")
|
||||||
x = x + l.XS
|
x += l.XS
|
||||||
s.waste = WasteStack(x, y, self)
|
s.waste = WasteStack(x, y, self)
|
||||||
l.createText(s.waste, "se")
|
l.createText(s.waste, "se")
|
||||||
|
|
||||||
|
@ -156,22 +156,22 @@ class OddAndEven(RoyalCotillion):
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
s.foundations.append(
|
s.foundations.append(
|
||||||
self.Foundation_Class(x, y, self, i, dir=2, mod=13))
|
self.Foundation_Class(x, y, self, i, dir=2, mod=13))
|
||||||
x = x + l.XS
|
x += l.XS
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
s.foundations.append(
|
s.foundations.append(
|
||||||
self.Foundation_Class(
|
self.Foundation_Class(
|
||||||
x, y, self, i, dir=2, mod=13, base_rank=1))
|
x, y, self, i, dir=2, mod=13, base_rank=1))
|
||||||
x = x + l.XS
|
x += l.XS
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
x, y, = l.XM + ((4, 3)[i])*l.XS, l.YM + (i+1)*l.YS
|
x, y, = l.XM + ((4, 3)[i])*l.XS, l.YM + (i+1)*l.YS
|
||||||
for j in range((4, 5)[i]):
|
for j in range((4, 5)[i]):
|
||||||
s.reserves.append(ReserveStack(x, y, self, max_accept=0))
|
s.reserves.append(ReserveStack(x, y, self, max_accept=0))
|
||||||
x = x + l.XS
|
x += l.XS
|
||||||
x, y = l.XM, self.height - l.YS
|
x, y = l.XM, self.height - l.YS
|
||||||
s.talon = WasteTalonStack(x, y, self, max_rounds=2)
|
s.talon = WasteTalonStack(x, y, self, max_rounds=2)
|
||||||
l.createText(s.talon, "n")
|
l.createText(s.talon, "n")
|
||||||
l.createRoundText(s.talon, 'nnn')
|
l.createRoundText(s.talon, 'nnn')
|
||||||
x = x + l.XS
|
x += l.XS
|
||||||
s.waste = WasteStack(x, y, self)
|
s.waste = WasteStack(x, y, self)
|
||||||
l.createText(s.waste, "n")
|
l.createText(s.waste, "n")
|
||||||
|
|
||||||
|
@ -319,17 +319,17 @@ class Alhambra(Game):
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
|
s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
|
||||||
max_move=0))
|
max_move=0))
|
||||||
x = x + l.XS
|
x += l.XS
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
|
s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
|
||||||
max_move=0, base_rank=KING, dir=-1))
|
max_move=0, base_rank=KING, dir=-1))
|
||||||
x = x + l.XS
|
x += l.XS
|
||||||
x, y, = l.XM+(8-reserves)*l.XS//2, y+l.YS
|
x, y, = l.XM+(8-reserves)*l.XS//2, y+l.YS
|
||||||
for i in range(reserves):
|
for i in range(reserves):
|
||||||
stack = OpenStack(x, y, self, max_accept=0)
|
stack = OpenStack(x, y, self, max_accept=0)
|
||||||
stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, l.YOFFSET
|
stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, l.YOFFSET
|
||||||
s.reserves.append(stack)
|
s.reserves.append(stack)
|
||||||
x = x + l.XS
|
x += l.XS
|
||||||
x, y = l.XM+(8-1-rows)*l.XS//2, self.height-l.YS
|
x, y = l.XM+(8-1-rows)*l.XS//2, self.height-l.YS
|
||||||
s.talon = Alhambra_Talon(x, y, self, max_rounds=3)
|
s.talon = Alhambra_Talon(x, y, self, max_rounds=3)
|
||||||
if rows == 1:
|
if rows == 1:
|
||||||
|
@ -680,7 +680,7 @@ class ThreePirates(Game):
|
||||||
x, y, = l.XM+l.XS, l.YM
|
x, y, = l.XM+l.XS, l.YM
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
s.foundations.append(SS_FoundationStack(x, y, self, suit=i//2))
|
s.foundations.append(SS_FoundationStack(x, y, self, suit=i//2))
|
||||||
x = x + l.XS
|
x += l.XS
|
||||||
|
|
||||||
x, y, = l.XM, l.YM+l.YS
|
x, y, = l.XM, l.YM+l.YS
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
|
|
|
@ -814,9 +814,9 @@ class OptionsMenuDialog(LMenuDialog):
|
||||||
self.menubar.tkopt.cardbacks[i], bi,
|
self.menubar.tkopt.cardbacks[i], bi,
|
||||||
self.make_vars_command(
|
self.make_vars_command(
|
||||||
self.menubar.mOptSetCardback, i))
|
self.menubar.mOptSetCardback, i))
|
||||||
bi = bi + 1
|
bi += 1
|
||||||
|
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
# Table background settings
|
# Table background settings
|
||||||
|
@ -866,7 +866,7 @@ class OptionsMenuDialog(LMenuDialog):
|
||||||
tm = self.app.tabletile_manager
|
tm = self.app.tabletile_manager
|
||||||
# cnt = tm.len()
|
# cnt = tm.len()
|
||||||
i = 1
|
i = 1
|
||||||
while 1:
|
while True:
|
||||||
ti = tm.get(i)
|
ti = tm.get(i)
|
||||||
if ti is None:
|
if ti is None:
|
||||||
break
|
break
|
||||||
|
@ -874,7 +874,7 @@ class OptionsMenuDialog(LMenuDialog):
|
||||||
ti.name,
|
ti.name,
|
||||||
self.menubar.tkopt.tabletile, i,
|
self.menubar.tkopt.tabletile, i,
|
||||||
self.menubar.mOptTileSet)
|
self.menubar.mOptTileSet)
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
# Card view options
|
# Card view options
|
||||||
|
|
|
@ -523,21 +523,19 @@ class Status_StatsDialog(MfxMessageDialog): # MfxDialog
|
||||||
def __init__(self, parent, game):
|
def __init__(self, parent, game):
|
||||||
stats, gstats = game.stats, game.gstats
|
stats, gstats = game.stats, game.gstats
|
||||||
w1 = w2 = ''
|
w1 = w2 = ''
|
||||||
n = 0
|
n = sum([len(s.cards) for s in game.s.foundations])
|
||||||
for s in game.s.foundations:
|
|
||||||
n = n + len(s.cards)
|
|
||||||
w1 = (_('Highlight piles: ') + str(stats.highlight_piles) + '\n' +
|
w1 = (_('Highlight piles: ') + str(stats.highlight_piles) + '\n' +
|
||||||
_('Highlight cards: ') + str(stats.highlight_cards) + '\n' +
|
_('Highlight cards: ') + str(stats.highlight_cards) + '\n' +
|
||||||
_('Highlight same rank: ') +
|
_('Highlight same rank: ') +
|
||||||
str(stats.highlight_samerank) + '\n')
|
str(stats.highlight_samerank) + '\n')
|
||||||
if game.s.talon:
|
if game.s.talon:
|
||||||
if game.gameinfo.redeals != 0:
|
if game.gameinfo.redeals != 0:
|
||||||
w2 = w2 + _('\nRedeals: ') + str(game.s.talon.round - 1)
|
w2 += _('\nRedeals: ') + str(game.s.talon.round - 1)
|
||||||
w2 = w2 + _('\nCards in Talon: ') + str(len(game.s.talon.cards))
|
w2 += _('\nCards in Talon: ') + str(len(game.s.talon.cards))
|
||||||
if game.s.waste and game.s.waste not in game.s.foundations:
|
if game.s.waste and game.s.waste not in game.s.foundations:
|
||||||
w2 = w2 + _('\nCards in Waste: ') + str(len(game.s.waste.cards))
|
w2 += _('\nCards in Waste: ') + str(len(game.s.waste.cards))
|
||||||
if game.s.foundations:
|
if game.s.foundations:
|
||||||
w2 = w2 + _('\nCards in Foundations: ') + str(n)
|
w2 += _('\nCards in Foundations: ') + str(n)
|
||||||
#
|
#
|
||||||
date = time.strftime('%Y-%m-%d %H:%M',
|
date = time.strftime('%Y-%m-%d %H:%M',
|
||||||
time.localtime(game.gstats.start_time))
|
time.localtime(game.gstats.start_time))
|
||||||
|
|
Loading…
Add table
Reference in a new issue