Coder Social home page Coder Social logo

shlomif / pysolfc Goto Github PK

View Code? Open in Web Editor NEW
445.0 30.0 97.0 107.91 MB

A comprehensive, feature-rich, open source, and portable, collection of Solitaire games.

Home Page: http://pysolfc.sourceforge.net/

License: GNU General Public License v3.0

Tcl 3.43% Shell 0.19% Python 66.76% Makefile 0.03% HTML 29.46% Perl 0.12% Vim Script 0.01%
python freecell-solver solitaire solitaire-game patience open-source game card-game cards hacktoberfest

pysolfc's Introduction

PySol FC logo

PySol Fan Club edition

This is an open source and portable (Windows, Linux and Mac OS X) collection of Card Solitaire/Patience games written in Python. Its homepage is https://pysolfc.sourceforge.io/.

The maintenance branch of PySol FC on GitHub by Shlomi Fish and by some other people, has gained official status, ported the code to Python 3, and implemented some other enhancements.

  • CI tests at GitHub AppVeyor Build status

Call for Contributors

Shlomi Fish, who adopted PySol FC, and maintained it for several years, has stepped down as its primary maintainer due to the fact he no longer plays PySol, or other computer card games too much and that it has been a time sink for him. (Also see this Twitter discussion ). We are looking for other contributors and there are still some large-scale features that can be implemented.

Screenshots

Screenshot of PySol FC

Requirements.

Installation.

We provide an installer for Windows (requires Windows XP SP3 or higher) as well as an Android package on F-droid.

Running from source without installation.

You can run from the source directory:

python pysol.py

After following steps similar to these (on Mageia Linux ):

Step 1 - install the dependencies

On Fedora you can do:

sudo dnf builddep PySolFC

On Mageia you can do:

sudo urpmi git make pygtk2 pygtk2.0-libglade gnome-python-canvas tkinter

On Debian / Ubuntu / etc. you can do:

sudo apt-get install cpanminus make perl python3-setuptools python3-tk

Step 2 - build PySol.

You can try running:

python3 scripts/linux-install.py
git clone https://github.com/shlomif/PySolFC.git
cd PySolFC
# Now make sure you have installed the dependencies.
gmake test
gmake rules
ln -s data/images images
tar -xvf PySolFC-Cardsets-3.0.tar.bz2 # Needs to be downloaded from sourceforge
mkdir -p ~/.PySolFC
rmdir ~/.PySolFC/cardsets
ln -s "`pwd`/PySolFC-Cardsets-3.0" ~/.PySolFC/cardsets
python pysol.py

Note! If you are using a Debian derivative (e.g: Debian, Ubuntu, or Linux Mint) and you are getting an error of "No cardsets were found !!! Main data directory is [insert dir here] Please check your PySol installation.", then you likely installed the cardsets package which has removed some files that are needed by pysol from source (without the debian modifications).

Please uninstall that package and use the cardsets archive from sourceforge.net per the instructions above.

Installing from source and running in a python venv (virtual environment)

At the moment, this only works on POSIX (Linux, FreeBSD and similar) systems. Windows and Mac users - you'll need to chip in with a script for your system.

1 - Install build prerequisites: six, random2 and pysol-cards

This is kind of stupid and maybe it can be fixed in the future, but for now:

pip install six
pip install random2
pip install pysol-cards

You may want to use your OS distribution package system instead, for example:

sudo apt-get install python-six
sudo apt-get install python-random2

For Pillow compilation, libjpeg headers and libraries need to be available:

sudo apt-get install libjpeg-dev

2 - Clone the source from version control

git clone git://github.com/shlomif/PySolFC.git
cd PySolFC

3 - Create your virtual environment.

PKGTREE=/usr/local/packages/PySolFC # or whatever
export PKGTREE
mkdir -p "$PKGTREE"
( cd "$PKGTREE" && python -m venv ./env )

4 - Run the install script

./contrib/install-pysolfc.sh

5 - Put cardsets into place as above.

6 - Enjoy playing

"$PKGTREE"/env/bin/pysol.py

Alternate toolkit.

  • Kivy
  • Features:
    • Sound support integrated.
    • Android apk build support.
  • Running from source without installation:
python pysol.py --kivy

Android App

On the basis of Kivy an Android App is also available. You may build your own using appropriate build instructions in README.android and in Directory buildozer.

Some versions will also be published on F-droid.

Get it on F-Droid

Configuring Freecell Solver

If you want to use the solver, you should configure freecell-solver ( https://fc-solve.shlomifish.org/ ) by passing the following options to its CMake-based build-system: -DMAX_NUM_FREECELLS=8 -DMAX_NUM_STACKS=20 -DMAX_NUM_INITIAL_CARDS_IN_A_STACK=60.

Install Extras.

Related repositories and links

Related:

Other open source solitaires:

  • solitaire.gg - web-based and written in Scala
  • Solitairey - web-based written in JavaScript
  • KPat - desktop-based for KDE.
  • Aisleriot - desktop-based by the GNOME project with relatively limited functionality.

Screencasts:

Chat

To facilitate coordination about contributing to PySol, please join us for a real time Internet chat on the ##pysol chat room on Freenode (note the double octothorpe/hash-sign/pound-sign). We may set up chat rooms on different services in the future.

In addition, we set up a Google Group for discussing open source card games which will also be used for discussing PySol. Feel free to subscribe or post!

pysolfc's People

Contributors

arthusppp avatar bubonicfred avatar c0rn3j avatar cardset avatar drewcsillag avatar fbriere avatar ghostofiht avatar guillaumegaillard avatar hlef avatar jimsize avatar jnumm avatar joeraz avatar kingjon3377 avatar leahneukirchen avatar lufebe16 avatar lyokha avatar neelix57 avatar nobrowser avatar programator2 avatar sergiomb2 avatar shlomif avatar stephengroat avatar topimiettinen avatar voyageur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pysolfc's Issues

Assertion error sometimes

When playing PileOn or Small PileOn, (Select > French Games > One-Deck Games > Small PileOn), in rare occasions an assertion error can be triggered.

The assertion says assert c.face_up and as of this writing (commit 29a9a61) is in line 520 of game.py, visible here:

if self.gameinfo.si.game_flags & GI.GT_OPEN:

The reason is that occasionally (very rarely, but it has happened to me twice in a session) all four cards in a stack are equal, causing the stack to face down.

It is easier to reproduce with a reduced version, e.g. adding this to pysollib/game/pileon.py:

class SmallerPileOn(PileOn):
    TWIDTH = 3
    NSTACKS = 5
    PLAYCARDS = 4

registerGame(GameInfo(10001, SmallerPileOn, "Smaller PileOn",
                      GI.GT_1DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 0, GI.SL_MOSTLY_SKILL,
                      ranks=tuple([0]+range(16-SmallerPileOn.NSTACKS, 13)),
                      #(0, 10, 11, 12),
                      rules_filename = "pileon.html"))

and then selecting Smaller PileOn and pressing 'N' repeatedly.

Possible solutions that I can think of are to avoid generating such a deal (e.g. by redealing in case this situation is detected) and to remove the assertion.

OS X/Windows OSError when pysol.py run directly

Traceback:

Traceback (most recent call last):
  File "pysol.py", line 32, in <module>
    sys.exit(main(sys.argv))
  File "/Users/craig/Envs/py2-pysolfc/pysollib/main.py", line 369, in main
    r = pysol_init(app, args)
  File "/Users/craig/Envs/py2-pysolfc/pysollib/main.py", line 183, in pysol_init
    app.dataloader = DataLoader(args[0], f)
  File "/Users/craig/Envs/py2-pysolfc/pysollib/util.py", line 146, in __init__
    str(filenames))
OSError: pysol.py: DataLoader could not find ('html/license.html',)

Replicated master branch into empty python 2.7.13 environment like such:

$ git clone ...
$ cd PySolFC
$ python2 -m virtualenv .
$ source bin/activate
$ pip install six
$ python pysol.py

Happens on the Windows 7 computer I tried it on too. I believe the issue is the naming of the directory, I've tested a change and got it to run. I will submit a pull request for it when I make sure it is not affecting anything else.

Playing directly on the desktop

Maybe fullscreen mode would be enough... However, I have never seen a solitaire where you could play directly on the desktop so that feature could be quite unique. :)

Customizable table view with columns instead of solitaire categories folder structure in "Playable preview..."

I think a table view with customizable columns (by customizable, I mean with an option for adding/removing columns with different sorting categories, as well as with an option to move such columns to the left or right) would work much better than these folders with solitaire categories that we have now. Clicking on a given column's header would revert the sorting order, i.e. for example, A-Z -> Z-A.

If you have no idea what I mean, check this out for an inspiration (focus on the table/columns part of the screenshot).

table_view_example

Ability to choose, sort by favourite card-sets

For fast access of gaming appearance.

As a case. e.g.: Ability to create in card-set tree - "Favourite folder"

  • then drag'n'drop(or another way: to add by right button click menu on card-sets name chosen by you in existing card-sets tree).

make dist fails on current master

Cannot make a dist on current master:

lb@lb7520 ~/PySolFCwork $ make dist
PYTHONPATH=pwd ./scripts/all_games.py > docs/all_games.html
Traceback (most recent call last):
File "./scripts/all_games.py", line 257, in
create_html(sort_by)
File "./scripts/all_games.py", line 176, in create_html
all_games(sort_by)
File "./scripts/all_games.py", line 142, in all_games
rules_fn = getGameRulesFilename(gi.name)
File "./scripts/all_games.py", line 36, in getGameRulesFilename
return latin1_normalize(n) + '.html'
NameError: global name 'latin1_normalize' is not defined
make: *** [Makefile:26: all_games_html] Fehler 1

When I check with flake8:

lb@lb7520 ~/PySolFCwork $ flake8 scripts/all_games.py
scripts/all_games.py:14:1: F401 'pysollib.games.mahjongg' imported but unused
scripts/all_games.py:18:1: F401 'pysollib.mfxutil.latin1_to_ascii' imported but$
scripts/all_games.py:36:12: F821 undefined name 'latin1_normalize'

Needs manual testing because skipped in tests/style/py-flake8.t. But -
is it allowed to ask why such a skipping list exists ?

.jpg backgrounds are not displayed when one uses Pillow instead of PIL

See https://bugs.mageia.org/show_bug.cgi?id=10729 :

Description of problem:

After the upgrade to python-pillow, PySolFC cannot load .jpg files as table tiles. It can load .gifs fine.

shlomif[rpms]:$mageia/python-pillow$ rpm -ql PySolFC | grep -P '\.jpg$'
/usr/share/PySolFC/images/stats/progression.jpg
/usr/share/PySolFC/tiles/save-aspect/Paradise_Wide.jpg
/usr/share/PySolFC/tiles/stretch/Blue_Fractal.jpg

But I cannot see the Paradise_Wide.jpg and the Blue_Fractal.jpg table tile in the list in [Menu] -> Options -> "Table Tile..." nor is my custom table tile still displayed. This seems like a regression from python-imaging.

Version-Release number of selected component (if applicable):

Cauldron.

How reproducible:

Steps to Reproduce:

  1. Install the "PySolFC" package.
  2. Run pysol on the command line.
  3. Access [Menu] -> Options -> "Table Tile..."

Reproducible:

Steps to Reproduce:

"Find card" window -- an option to show where each card is located including covered ones

In the "Find card" window there could be an option (a checkbox?) to show where each card is located, i.e. the app would search not only for uncovered cards, but for covered ones too including the deck and the waste. The numerical value could be displayed (in the "Find card" window, on the table?) to tell the user exactly when a given card will show up in a particular deck (the card's position). This option would work like a nice hint, allowing for some deep strategies too. Of course, with this option activated, no card symbol would be grayed out (see: #19 unless a given card is unavailable in a solitaire), just as it is now.

A guide for creating custom cardsets.

Custom PySol cardsets outside the downloadable cardset pack are a rare thing in the Internet even in 2017. This is probably due to the fact that the config file specification is not well documented. Perhaps a guide for creating custom cardsets might solve this issue a bit.

Github workflow, discussions, issues

I have no previous experience of Github, I'm hoping some here in Github/PySolFC have participated in other shared projects on Github and can advise what works.

My impression is that our need for discussion is cluttering issues, leading us off-topic. In a few years (months?) time that will make it hard to review an issue. E.g. on Ubuntu's Launchpad often a bug is reported and if it isn't fixed quickly then there can be 50 or 100 follow-ups, arguments, irrelevancies, etc. Developers have little spare time, and such bugs are just left to rot, the extensive trail discourages devs. So we should aim to keep our issues focussed.

I would imagine a PySolFC mailing list would be a good way to avoid some of this clutter. Github doesn't seem to have mailing lists for projects. Might the wiki be a solution?

Unable to install: "No cardsets were found"

I am unable to follow the installation description and successfully run pysol from the github repo.

I have performed the following steps, taken from the brief installation description in the readme.

$ git clone https://github.com/shlomif/PySolFC.git
$ cd PySolFC
$ ln -s html-src html
$ ln -s data/images images
$ tar -xvf PySolFC-Cardsets-2.0.tar.bz2
$ mkdir -p ~/.PySolFC
$ rmdir ~/.PySolFC/cardsets
$ ln -s ~/.PySolFC/cardsets PySolFC-Cardsets-2.0

When I then run python2 pysol.py, I get the "No cardsets were found" error.

I'll note that I have python and tkinter. I did download the cardsets from sourceforge. I'm not sure about the intention of the final symbolic link, but I tried several variations of this symlink and I didn't succeed.

Documentation

I'd like to add function/class/method documentation using ReStructed Text (RST), which is usable by Sphinx and other tools. This would make it easier to view documentation in one place and to quickly see what a function/method is returning and does, as I've noticed quite a few functions being rather opaque when trying to debug my local copy.

Reference and example file:
http://thomas-cokelaer.info/tutorials/sphinx/docstring_python.html
http://docutils.sourceforge.net/docutils/statemachine.py

PySolFC developers thread

All the matters regarding programming solutions for PySolFC and development can be discussed here first. If necessary, separate issue tickets would be created.

This topic will be used solely by PROGRAMMERS and not by users.

Find card/tile option -- support for other games

It would be nice to implement the "Find card" option for other PySol card games as well (now it only works with French cards, I guess.) We can also think about searching options for mahjong tiles.

Prepare an MS Windows Binary Installer

We wish to prepare a functional Windows binary installer that will install cpython (preferably 3.x) and then the pysol sources and provide a usable way to run it for non-technical people. Some leads:

While waiting for vector support maybe let's use higher quality images for cardsets (with first new builds)?

Before creating PySolFC 2.1 builds for various systems, I suggest taking into account the fact that currently used cardsets are extremely small, and they look really, really bad on modern screens. To temporarily alleviate this issue and to avoid negative user feedback (while waiting for proper vector support), we might simply ship PySolFC with at least one additional (which could be used as the default one) higher resolution cardset. I mean something like this guy did here (ignore the card backs s/he suggested, just focus on the cards). AFAIK, these seem to be cardsets which are in the public domain, we might need to ask him/her about this.

But PySolFC definitely looks much better this way... Some time ago I talked to shlomif on IRC that PySolFC needs a major graphical overhaul, taking care of (even if temporarily) the most serious issue, i.e. small cardsets could be a step in the right direction.

Make the code comply with python3's flake8

On this branch - https://github.com/shlomif/PySolFC/tree/add-flake8-tests - I added this test - https://github.com/shlomif/PySolFC/blob/add-flake8-tests/tests/style/py-flake8.t - which checks a subset of the python files for compliance with the python 3 version of flake8. This will help us convert to python 3 ( see #11 ) later on and is easy thing to help with - just add more files to the glob and make them comply with flake8. You may look at the previous commits in the repository for some inspiration including the "if sys.version" compatibility shims.

"How to play" text might be a bit confusing

I mean the text in "Help" -> "How to play", it might be taken by the user for "rules" at first glance. Change it something like "How to play PySol" or "How to use PySol".

General discussion thread

Update: Discussions are better held on the Google Group .

I've got a question. Should we wait with bug reporting and feature requests until the Python 3 port will be ready? Or maybe we should create new tickets now to facilitate the creation of a roadmap/development plan for the future and discussion? It's obvious that the implementation of some features can take a very long time and that some stuff is low-priority.

Apart from our own ideas, I suggest looking at the biggest solitaire packages on the market, i.e. Pretty Good Solitaire, SolSuite, and BVS Solitaire Collection (even in a virtual machine), as well as at some open source solitaire apps to see if we find something interesting.

"Settings..." panel

Let's say that we want to, for instance, activate "Redeal animation" first and then activate also "Winning animation." Well... We have to go to "Options" in the menu bar two times because after choosing "Redeal animation", all the menus close and we have to start again.

So to tweak settings more effectively we need a settings panel (menu bar: "Options" -> "Settings..."). It will also allow us to nicely put settings into different categories as well as to avoid cluttering the menu bar with new settings that we may plan to add. Some of the most important settings might be available through the old menu bar "Options" too.

An inspiration for the settings panel

settings_panel

Make the solver's dialog's settings stick/persist/be saved across invocations and sessions

Currently the solver dialog (Assist → Solver when playing Freecell or other supported games) does not remember its "Preset" , "Max Iterations" and "Show Progress" settings - either across sessions of PySol or even after closing and invoking it again. It should remember those but note that it should not remember the "Game" setting because one can switch to a different game.

File -> "Save as" stopped working on the git master

File → "Save as" stopped working properly and throws this exception:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib64/python2.7/lib-tk/Tkinter.py", line 1542, in __call__
    return self.func(*args)
  File "/home/shlomif/Download/unpack/games/pysolfc/git/PySolFC/pysollib/ui/tktile/menubar.py", line 1223, in mSaveAs
    d = tkinter_filedialog.SaveAs()
AttributeError: 'module' object has no attribute 'SaveAs'

Merge "All games..." with "Playable preview..."

"Playable preview..." offers the same functionality as the "All games..." option + much more. Thus, I suggest renaming "Playable preview" to "All games...", and getting rid of the old "All games..." view altogether.

Of course, for this change to make any sense, the problem with slow switching between games in "Playable preview..." has to be fixed first.

To fully understand my vision of enhancing "Playable preview..." (or the "All games..." view after renaming) check these issues too: #34 #35

Modernized icon set

I think PySolFC looks to me a bit outdated, mainly because of the current icon set. I guess it could be refreshed.

Of course, I don't mean that you have to code and create new graphics. :P It just would be good to look for some designer (maybe let's post this on various Linux forums?).

New name and promotion

When you finish porting PySolFC to Python 3 and you add SVG support (to make PySolFC resolution-independent), you can definitely think about a name change. My suggestion is: PySol+ (BTW, PySolFC was a strange name in the first place).

That would be the right time to think about promotion too:

-- create a very simple website using: https://pages.github.com/ Including info on your efforts as well as on PySol's history and legacy.

-- tell people that PySol is still alive in the form of PySol+ using reddit, Hacker News, Slashdot, and GamingOnLinux (these website are frequented by those who are "in the know", they gonna tell the others about the project). A lot of users are really nostalgic about PySol, but they simply don't know that your repo exists. It took me some time to find it as well.

-- create a Patreon account (nice example: https://www.patreon.com/Nekotekina) to earn some cash because why not?

Flickering window on Mac OS X 10.9

If you try to read an icon description (wait for the tool-tip to show up), and then you move the cursor over to another icon, the PySolFC window and the icon description tool-tip start to flicker like a crazy.

Merge "help bar" with "status bar"

If you click "Options" -> "Statusbar" -> "Show help bar" you will have as if two "status bars". I think it would look more elegant if we merge the "help bar" with the "status bar" and change the "Show help bar" option to "Show help info".

Convert the code to Python 3

As Python 2.x is going away, we need to convert the code to use Python 3 instead. A prerequisite for that is to merge duplicate or mostly duplicate code that uses the APIs that were removed in Python 3.

Solitaire search field for "Playable preview" + one-key shortcut for opening "Playable preview" with the text cursor in this search field to quickly start searching

Let's say the user wants to find a solitaire by name:

  1. He or she presses, for instance, the "F" key.

  2. "Playble Preview" opens with the text cursor in the search field.

  3. The user immediately starts typing.

  4. The results could be presented nicely, for instance, in the column view.

This solitaire search field could also be used to look for alternate solitaire names as well as other info.

Cannot build in debian

The Step 2 - build PySol. is not suitable for Debian: no gmake nad urpmi.
The default Card-sets PATH installed form Debian repostiories is - /usr/share/games/pysolfc

Simplified cards/tiles and simple background for "Playable Preview"

I think the preview in "Playable Preview" would be much clearer is we stick to some simple background (overriding the user's settings), and if we use simplified cards like those often seen in mobile apps with big symbols and numbers
unnamed
(check the attachment for an example).

SVG graphics

PySolFC a fantastic solitaire collection, it's just a pity that there is only one person currently working on it. :( Even after all these years, the mechanics seem to be all right, the music is awesome, however, the UI could be modernized. By switching to SVG cards one could support any resolution. I have also this crazy idea, that cards could be played directly on the desktop... This would be like a real solitaire on a real table (without window boundaries).

Regards,
Jan

shishensho crashes

current master: shishensho.py, line 352:

cl.reverse()
AttributeError: 'xrange' object has no attribute 'reverse'

change to:
cl = reversed(cl)

Restrict cardset/tiles use by the game type to avoid mixing them up

For example, if you play "Klondike" and you change "Cardset..." to "Tiny cardsets" -> "Crystal Mahjongg", the cards would turn into mahjong tiles. Also, each game in "Playable Preview" would be previewed with mahjong tiles. It is possible to mix up this way any other types of cards and tiles as well. I think there should exist restrictions on which game can use which cards or tiles, so that choosing, for instance, Hanafuda cards when playing Matrix games would be impossible. What is more, I have found out that even if you don't change any settings, and you launch a card game first, each mahjong game will be previewed with playing cards in "Playable preview".

BTW, restarting PySolFC does not help, you have to "select" a solitaire again (e.g. from the game list) to fix a wrong card/tile type on the table.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.