Installing ksnakeduel drags in a lot of "stuff"

Forum Forums General Software Installing ksnakeduel drags in a lot of "stuff"

This topic contains 10 replies, has 2 voices, and was last updated by BobC Jul 1-10:01 am.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #10801
    Member

    BobC

    Its sad that I like that dumb game so much that I keep installing it even though it takes a huge amount of space to drag in a mountain of KDE stuff, but its just that that is the only KDE app that I like enough to do it for.

    I think I will try to recreate it in Python somehow. Its about time I learned the object oriented programming stuff, and the only way to learn it is to do something with it…

    • This topic was modified 6 months ago by BobC.
    #10808
    Member

    736b69646f6f

    a game program can be tiny, like 100kb or less.
    Snake sprite can be displayed as ascii characters in terminal, or with ncurses ui, or it can have fancier ui based on pygame.
    For the dueling (against an opponent) feature, might need to checkout games-n-tutorials titled “tron”, not “snake”.
    Anyhow, here are some leads

    tutorial https://pythonspot.com/snake-with-pygame/ and https://www.youtube.com/watch?v=4MUcUhL0tMw

    many ready to run variations of the snakegame https://www.pygame.org/tags/snake

    also
    https://github.com/tancredi/python-console-snake/tree/master/snake
    http://www.grantjenks.com/docs/freegames/#snake
    https://github.com/PPastorF/python-snake/blob/master/snake.py

    #10810
    Member

    BobC

    As always you seem to be treasure chest of knowledge willing to share, and I do appreciate it. If I find it already written I’ll figure it out enough to tweak and tune it, so I learn how it works.

    I always learn mmore when its creating something I’d like to have…

    #10909
    Member

    BobC

    I am thinking of trying a 2048 game too. It seems to me that the snake game maybe could be modified to add an AI second player.

    I see pygame is 6 mb, so that explains why its not included in AntiX.

    Do you think I will be able to do it from scratch with tkinter (takes less than 100k) and without pygame or should I just bite the bullet and install pygame?

    #10910
    Member

    736b69646f6f

    Because tk.canvas lacks reasonable antialiasing, I am not a fan of tkinter.
    If you go that route (mebbe okay for squarish sprites, stuff like tetris) take a look at the pygubu tool for rapid UI creation.

    pygame (python-pygame) (AND probably python-pygame-sdl2)
    wow, better budget quite a lot more drive space, given the dependencies. The numerical python (numpy) library, that alone will be 12mb or so.
    When you run apt-get install, examine the details at the Y/n “proceed?” prompt. Well over 20mb new package will be installed, right?

    pygame has a rich selection of tutorials and decades worth of prior art available as examples to reverse engineer and active support community. You will have a blast!

    #10936
    Member

    BobC

    My knowledge level is insufficient with python itself, so even though the basic stuff is TOO basic, I’m just going to start with python itself until I can understand the syntax, terminology and objects and their usage. I tried some pygames and tkinter ones, and they assume I already know and understand those things, but I don’t. If there is a difficulty, its that my brain is tired from work, so my attention span is too short to be able to make progress as quick as I’d like.

    I’d rather really understand it, not just be able to tweak. I can always fall back to there if I have to. It would be cool to be able to tweak a few small games and get them to work and make them easy to install. It might be more than I’m able to do at present, but it would be a good goal.

    I’ll have to look at pygubu… Thanks for the suggestions.

    #11080
    Member

    BobC

    re:Python…

    Am I learning the wrong language?

    If everyone else is putting all their development effort into “phone apps”, should I be putting this time into learning that instead?

    But if that’s true, and let’s say I created ad-free android apps, forgive my ignorance, but are those different from java?

    How would I develop and run them on AntiX, hopefully without needing to load tons of other “stuff”?

    #11089
    Member

    736b69646f6f

    can’t see spending much attention worrying about what “everyone else” is doing, but hey suit yourself.
    “say I created ad-free android apps”
    I don’t use android so don’t give a hoot about that platform, but more than just a few android apps are written in python.
    When an app gets built for, packaged for, android yeah it’s likely to be automatically converted to java bytecode along the way. Automatically, but your program would need to incorporate qpython or kivy components…

    “How would I develop and run them on AntiX, hopefully without needing to load tons of other stuff?”
    Them? It ain’t quite like that. You write a program on whatever platform then build/package/test on whatever other targets you also wish to support.

    As an example, let’s consider PySol (solitaire card game, written in python)(includes hundreds of playable solitaire variants)
    http://www.pysol.org/
    development ceased in 2003
    Note that pysol.org website is still available, and advises that it has been superceded by “PySol Fan Club edition” (and contains a link to pysolfc.sourceforge.net)

    https://en.wikipedia.org/wiki/PySol
    PySol was originated by Markus F.X.J. Oberhumer in 1998. It is written in the Python programming language, and it uses the Tk GUI toolkit. While development of the original PySol officially ceased in 2004, several forks, including PySolitaire, UltraSol, FlowerSol, and PySol Fan Club Edition (also known as “PySolFC”) continue to be developed by the game’s community.

    PySolFC was noted by several news outlets positively as a “tremendous collection of Solitaire games, going well beyond the usual mix” and was downloaded from Sourceforge alone 290,000 times between 2006 and May 2017. PySolFC is also included in many Linux distributions like Ubuntu, Fedora, OpenSuse, Debian, and also ported to other platforms such as Microsoft Windows, Mac…

    In December 2000 CNN placed PySol among the “Top 10 Linux games for the holidays”. PySol received in 2003 The Linux Game Tome’s Best Free Cards/Board/Gambling Game award.

    2014, “it” wound up added to google play store https://play.google.com/store/apps/details?id=org.zyb.pysolfc&hl=en_US
    and was NOT well received. Read the user reviews about ads, and missing features, and bugginess
    and the response by the 2014 apk uploader (in this context, seems wrong to describe the person who uploaded the app as the PySol _author_)
    “There are a few reasons why this is the minus to PySolFC. The fundamental one is the underlying framework used by PySolFC is not fit for Android, I had to build that for Android, but sorry it seems not perfectly done.”

    Oct 2017 “it” was packaged for and added to F-Droid collection, and cites pysolfc.sourceforge.net as project homepage)
    https://f-droid.org/en/packages/org.lufebe16.pysolfc/
    “A new user interface has been developed using the kivy framework to meet requirements of touch screens devices.”
    BUT
    https://gitlab.com/fdroid/rfp/issues/181
    the F-Droid request for packaging page cites “Source Code: bitbucket.org/lufebe16/pysolfc” (contains code that was LastUpdated in Feb 2018)

    Python on Android


    https://pypi.org/project/python-for-android/

    http://pysolfc.sourceforge.net/ This is, and has been (as linked from pysol.org, back in 2003) the official homepage for the project.
    And on this page we find “Source repository on GitHub: github.com/shlomif/PySolFC”
    (this github project repository was created April 2017)
    READ the shlomif/PySolFC project page at gihub and note that (on your antiX O/S) you can simply:
    1) download the project code
    2) install the libraries it depends on
    sudo apt-get install -y ack-grep cpanminus libperl-dev make perl python-glade2 python-gnome2 python-gnome2-dev python-gtk2 python-setuptools python-tk
    3) cd into the source directory and “python pysol.py”

    or you could, and perhaps pereceived as “even more simply” apt-get install pysolfc
    https://packages.debian.org/stretch/pysolfc
    The packaged-for-debian version (pysolfc v2.0-4) is dated Apr 2016 and (so) lacks the integrated Kivy touch-friendly UI bits.

    If you wanted to use Kivy (for pysol or other app) debian does have packaged versions available
    https://packages.debian.org/search?keywords=kivy&searchon=names&suite=stable&section=all
    but, again, those packages are dated 2016

    You might check reverse depends, to find what all debian packages depend on those Kivy packages.
    Probably very few do, because touch functionality is not (at least not yet) a priority for programs packaged for use on desktop debian target.

    #11090
    Member

    736b69646f6f

    Your takeaway from that example may be different from mine. Here’s my assessment (and I don’t claim this is absolutely correct):
    If your python program, your “it”, is intended to support touch/mobile usage, you probably want the (not from debian) up-to-date version of the kivy libraries. If “it” does use those, and is packaged for use on debian/antiX, the “dragging in all sorts of extra stuff” must include re-packaging and redistributing those kivy libraries or creating a setup mechnism which demands python pip as a prerequisite, retrieving the libraries from the web as needed (yuk, as a potential user, pip is a showstopper. Like, if i was inclined to trust and use unvetted PPAs, i should be using ubuntu. or maybe archlinux + AUR). The status quo probably can’t change until someone interested (and blessed by debian bureaucracy) steps up, decides to maintain up-to-date debian packages for kivy. Instead, within debian ecosphere I’m noticing attention toward touch-enabled apps that utilize/depend DE-proprietary libraries.

    #11094
    Member

    BobC

    Thanks for the amount of research there! Your choice of basic subject example, ie Pysol, is perfect, as its a set of games I’m familiar with, at least from a standpoint of installing and playing on AntiX and other Linux distro’s.

    The big thing I read there is that Python is not likely to be a dead end street next month or next year, and so my efforts won’t be a waste if I figure it out. I’m at video 60 out of 156, and haven’t seen an import statement yet, and still don’t know what classes, attributes and methods are available in any of these libraries or how to find out, let alone make use of them or change things that do.

    My problem is the objects. I first learned to code in 1972, so my mind sees code as a sequence of input, process, and output, with straight lines and decisions determining the paths, and that takes a very different mentality. I did learn the object “stuff” back in the very early 90’s but the project died because the system was just too slow and hooked to a pre Y2K system that got replaced, and I never had demand to go back to an object oriented language after that, because everyone always wanted other things.

    I think I’m just going to keep plugging away at the Python direction I started, tweaking a simple python GUI game, and getting to where I have a simple snake, then me vs the computer snake/tron like game that doesn’t take a lot of dependencies to install, and possibly using a tic-tac-toe or 2048 game, whatever looks simplest, to use as a learning step to get there if I need to.

    Thanks for showing me it can still be useful beyond getting my games for the price of some effort…

    #11195
    Member

    BobC

    Never made it through the object stuff. I found “missing links”, that might help me get back on track, though. They have snake, tron and pacman.

    http://www.grantjenks.com/docs/freegames/index.html

    Minimal additional dependencies… On top of AntiX 17 full I needed to install:
    python3-pip
    python3-tk

    then…

    Quickstart

    Installing Free Python Games is simple with pip:

    $ python3 -m pip install freegames

    Free Python Games supports a command-line interface (CLI). Help for the CLI is available using:

    $ python3 -m freegames –help

    The CLI supports three commands: list, copy, and show. For a list of all games run:

    $ python3 -m freegames list

    Any of the listed games may be played by executing the Python module from the command-line. To reference the Python module, combine “freegames” with the name of the game. For example, to play the “snake” game run:

    $ python3 -m freegames.snake

    Games can be modified by copying their source code. The copy command will create a Python file in your local directory which you can edit. For example, to copy and play the “snake” game run:

    $ python3 -m freegames copy snake
    $ python3 snake.py

    Python includes a built-in text editor named IDLE which can also execute Python code. To launch the editor and make changes to the “snake” game run:

    $ python3 -m idlelib.idle snake.py

    You can also access documentation in the interpreter with Python’s built-in help function:

    >>> import freegames
    >>> help(freegames)

    • This reply was modified 5 months, 2 weeks ago by BobC.
Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.