mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Compare commits
4 commits
490f8f2f25
...
f9a09f864e
Author | SHA1 | Date | |
---|---|---|---|
|
f9a09f864e | ||
|
efd87e1257 | ||
|
d3b1674a47 | ||
|
91e5cdafa3 |
12 changed files with 54 additions and 36 deletions
|
@ -35,6 +35,7 @@ deploy:
|
||||||
dist: trusty
|
dist: trusty
|
||||||
before_install:
|
before_install:
|
||||||
- if test "$TRAVIS_OS_NAME" = "osx" ; then export CPPFLAGS="$CPPFLAGS -I$(brew --prefix openssl)/include" PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig:$PKG_CONFIG_PATH" LDFLAGS="$LDFLAGS -L$(brew --prefix openssl)/lib" ;fi
|
- if test "$TRAVIS_OS_NAME" = "osx" ; then export CPPFLAGS="$CPPFLAGS -I$(brew --prefix openssl)/include" PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig:$PKG_CONFIG_PATH" LDFLAGS="$LDFLAGS -L$(brew --prefix openssl)/lib" ;fi
|
||||||
|
- if test "$TRAVIS_OS_NAME" = "osx" ; then wget --content-disposition https://sourceforge.net/projects/pysolfc/files/PySolFC-Cardsets/minimal/PySolFC-Cardsets--Minimal-2.0.tar.xz/download && tar xJf PySolFC-Cardsets--Minimal-2.0.tar.xz && mv PySolFC-Cardsets--Minimal-2.0/cardset-* data ; fi
|
||||||
install:
|
install:
|
||||||
- sudo cpanm Code::TidyAll::Plugin::Flake8 Perl::Tidy Test::Code::TidyAll Test::Differences Test::TrailingSpace
|
- sudo cpanm Code::TidyAll::Plugin::Flake8 Perl::Tidy Test::Code::TidyAll Test::Differences Test::TrailingSpace
|
||||||
- export PY_MODS='pycotap random2 six'
|
- export PY_MODS='pycotap random2 six'
|
||||||
|
|
1
Brewfile
1
Brewfile
|
@ -1,3 +1,4 @@
|
||||||
|
brew "perl"
|
||||||
brew "cpanminus"
|
brew "cpanminus"
|
||||||
brew "gettext", link: true
|
brew "gettext", link: true
|
||||||
brew "gnutls"
|
brew "gnutls"
|
||||||
|
|
|
@ -326,6 +326,7 @@ class Rachel(pysollib.game.StartDealRowAndCards, RelaxedSpider):
|
||||||
|
|
||||||
class Scorpion_RowStack(Yukon_SS_RowStack, Spider_RowStack):
|
class Scorpion_RowStack(Yukon_SS_RowStack, Spider_RowStack):
|
||||||
canDropCards = Spider_RowStack.canDropCards
|
canDropCards = Spider_RowStack.canDropCards
|
||||||
|
canMoveCards = OpenStack.canMoveCards
|
||||||
|
|
||||||
|
|
||||||
class Scorpion(RelaxedSpider):
|
class Scorpion(RelaxedSpider):
|
||||||
|
|
|
@ -109,7 +109,7 @@ class Images:
|
||||||
imagedir = self.d.findDir(cs_type, d)
|
imagedir = self.d.findDir(cs_type, d)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
if (not USE_PIL and TOOLKIT is not 'kivy') or imagedir is None:
|
if (not USE_PIL and TOOLKIT != 'kivy') or imagedir is None:
|
||||||
# load image
|
# load image
|
||||||
img = self.__loadCard(filename+self.cs.ext, check_w, check_h)
|
img = self.__loadCard(filename+self.cs.ext, check_w, check_h)
|
||||||
if USE_PIL and img is not None:
|
if USE_PIL and img is not None:
|
||||||
|
@ -257,7 +257,7 @@ class Images:
|
||||||
return self._bottom[0]
|
return self._bottom[0]
|
||||||
|
|
||||||
def getBlankBottom(self):
|
def getBlankBottom(self):
|
||||||
if TOOLKIT is 'kivy':
|
if TOOLKIT == 'kivy':
|
||||||
return self._bottom[0]
|
return self._bottom[0]
|
||||||
return self._blank_bottom
|
return self._blank_bottom
|
||||||
|
|
||||||
|
|
|
@ -1688,7 +1688,7 @@ class LMainWindow(BoxLayout, LTkBase):
|
||||||
t = self.workStack.items[i]
|
t = self.workStack.items[i]
|
||||||
# print("stackkey: %s" % str(t[0]))
|
# print("stackkey: %s" % str(t[0]))
|
||||||
# print("stackitem: %s" % str(t[1]))
|
# print("stackitem: %s" % str(t[1]))
|
||||||
if t[0] is 'playground':
|
if t[0] == 'playground':
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if isinstance(t[1], LTopLevel):
|
if isinstance(t[1], LTopLevel):
|
||||||
|
|
|
@ -347,9 +347,9 @@ def markImage(image):
|
||||||
def _createImageMask(texture, color):
|
def _createImageMask(texture, color):
|
||||||
|
|
||||||
col = 0
|
col = 0
|
||||||
if (color is 'black'):
|
if (color == 'black'):
|
||||||
col = 0
|
col = 0
|
||||||
if (color is 'white'):
|
if (color == 'white'):
|
||||||
col = 255
|
col = 255
|
||||||
|
|
||||||
g = texture.pixels
|
g = texture.pixels
|
||||||
|
|
|
@ -1476,7 +1476,7 @@ class Stack:
|
||||||
if img is None:
|
if img is None:
|
||||||
return
|
return
|
||||||
# self.canvas.update_idletasks()
|
# self.canvas.update_idletasks()
|
||||||
if TOOLKIT is 'kivy':
|
if TOOLKIT == 'kivy':
|
||||||
self.game.top.waitAnimation()
|
self.game.top.waitAnimation()
|
||||||
item = MfxCanvasImage(self.canvas, card.x, card.y,
|
item = MfxCanvasImage(self.canvas, card.x, card.y,
|
||||||
image=img, anchor=ANCHOR_NW, group=self.group)
|
image=img, anchor=ANCHOR_NW, group=self.group)
|
||||||
|
@ -1657,7 +1657,7 @@ class DealRow_StackMethods:
|
||||||
self.game.flipMove(self)
|
self.game.flipMove(self)
|
||||||
self.game.moveMove(1, self, r, frames=frames)
|
self.game.moveMove(1, self, r, frames=frames)
|
||||||
self.game.leaveState(old_state)
|
self.game.leaveState(old_state)
|
||||||
if TOOLKIT is 'kivy':
|
if TOOLKIT == 'kivy':
|
||||||
self.game.top.waitAnimation()
|
self.game.top.waitAnimation()
|
||||||
return len(stacks)
|
return len(stacks)
|
||||||
|
|
||||||
|
@ -1689,7 +1689,7 @@ class DealRow_StackMethods:
|
||||||
self.game.moveMove(1, self, r, frames=frames)
|
self.game.moveMove(1, self, r, frames=frames)
|
||||||
break
|
break
|
||||||
self.game.leaveState(old_state)
|
self.game.leaveState(old_state)
|
||||||
if TOOLKIT is 'kivy':
|
if TOOLKIT == 'kivy':
|
||||||
self.game.top.waitAnimation()
|
self.game.top.waitAnimation()
|
||||||
return n
|
return n
|
||||||
|
|
||||||
|
@ -2473,7 +2473,7 @@ class BasicRowStack(OpenStack):
|
||||||
|
|
||||||
# Abstract class.
|
# Abstract class.
|
||||||
class SequenceRowStack(SequenceStack_StackMethods, BasicRowStack):
|
class SequenceRowStack(SequenceStack_StackMethods, BasicRowStack):
|
||||||
canMoveCards = OpenStack.canMoveCards
|
# canMoveCards = OpenStack.canMoveCards
|
||||||
|
|
||||||
def __init__(self, x, y, game, **cap):
|
def __init__(self, x, y, game, **cap):
|
||||||
kwdefault(cap, max_move=999999, max_accept=999999)
|
kwdefault(cap, max_move=999999, max_accept=999999)
|
||||||
|
@ -2907,7 +2907,7 @@ class WasteTalonStack(TalonStack):
|
||||||
else:
|
else:
|
||||||
self.game.moveMove(1, self, waste, frames=4, shadow=0)
|
self.game.moveMove(1, self, waste, frames=4, shadow=0)
|
||||||
self.fillStack()
|
self.fillStack()
|
||||||
if TOOLKIT is 'kivy':
|
if TOOLKIT == 'kivy':
|
||||||
self.game.top.waitAnimation()
|
self.game.top.waitAnimation()
|
||||||
elif waste.cards and self.round != self.max_rounds:
|
elif waste.cards and self.round != self.max_rounds:
|
||||||
if sound:
|
if sound:
|
||||||
|
|
|
@ -6,7 +6,7 @@ from pysol_tests.common_mocks1 import MockApp, MockCanvas, MockItem, MockTalon
|
||||||
|
|
||||||
import pysollib.stack
|
import pysollib.stack
|
||||||
from pysollib.acard import AbstractCard
|
from pysollib.acard import AbstractCard
|
||||||
from pysollib.games.spider import Scorpion_RowStack
|
from pysollib.games.spider import Scorpion_RowStack, Spider_RowStack
|
||||||
|
|
||||||
|
|
||||||
class MockGame:
|
class MockGame:
|
||||||
|
@ -60,3 +60,18 @@ class MyTests(unittest.TestCase):
|
||||||
stack = self._calc_Scorpion_stack()
|
stack = self._calc_Scorpion_stack()
|
||||||
self.assertTrue(stack.canMoveCards(stack.cards[4:]))
|
self.assertTrue(stack.canMoveCards(stack.cards[4:]))
|
||||||
self.assertTrue(stack)
|
self.assertTrue(stack)
|
||||||
|
|
||||||
|
def _calc_Spider_stack(self):
|
||||||
|
g = MockGame()
|
||||||
|
stack = Spider_RowStack(0, 0, g)
|
||||||
|
for s, r in [(2, 5), (3, 7), (2, 7), (2, 0), (2, 3), (2, 5), (1, 4)]:
|
||||||
|
c = AbstractCard(1000+r*100+s*10, 0, s, r, g)
|
||||||
|
c.face_up = True
|
||||||
|
c.item = MockItem()
|
||||||
|
stack.addCard(c)
|
||||||
|
return stack
|
||||||
|
|
||||||
|
def test_Spider_canMoveCards_non_top(self):
|
||||||
|
stack = self._calc_Spider_stack()
|
||||||
|
self.assertFalse(stack.canMoveCards(stack.cards[5:]))
|
||||||
|
self.assertTrue(stack)
|
||||||
|
|
Loading…
Add table
Reference in a new issue