For your enjoyment

260 views
Skip to first unread message

Victor Norman

unread,
Feb 1, 2021, 5:43:08 PM2/1/21
to brython
If you want, you can check out my completed Brython / FabricJS implementation of my old Python/Tkinter solitaire game. Thanks for your help here, friends.


Vic


Edward Elliott

unread,
Feb 1, 2021, 6:14:34 PM2/1/21
to bry...@googlegroups.com
Looks very nice.  Never saw this type of solitaire before.

Unfortunately I can't play it.  Clicking cards doesn't do anything.  Dragging just draws a blue shaded box on the surface.  Instructions say to move cards, but don't say how.  Not sure what's going on.



--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/61dd0f5f-f440-421c-82dc-ba57afa464b9n%40googlegroups.com.

Kiko

unread,
Feb 2, 2021, 2:04:23 AM2/2/21
to bry...@googlegroups.com
Some errors in the Firefox console :-(

downloadable font: kern: Unsupported table version: 1 (font-family:
"AstroSpace" style:normal weight:400 stretch:100 src index:0) source:
https://cs.calvin.edu/courses/cs/108/vnorman/brython/cardgame/AstroSpace-eZ2Bg.ttf
downloadable font: Table discarded (font-family: "AstroSpace"
style:normal weight:400 stretch:100 src index:0) source:
https://cs.calvin.edu/courses/cs/108/vnorman/brython/cardgame/AstroSpace-eZ2Bg.ttf
upgrade needed brython.js:5415:42
Un XMLHttpRequest síncrono en el hilo principal está desaprobado por
sus efectos negativos en la experiencia del usuario final. Para más
ayuda vea http://xhr.spec.whatwg.org/ brython.js:9407:57
no playsounds in storage
brython.js:6408:18
No se puede reproducir el medio. No hay decodificadores para los
formatos solicitados: audio/x-wav, audio/x-wav index.html
Traceback (most recent call last):
File VFS.browser.timer.py line 13, in f
msg='{0.info}\n{0.__class__.__name__}: {0.args[0]}'.format(exc)
File https://cs.calvin.edu/courses/cs/108/vnorman/brython/cardgame/main.py
line 395, in removeAces
self._card2ImgDict[id(card)].erase()
File https://cs.calvin.edu/courses/cs/108/vnorman/brython/cardgame/main.py
line 149, in erase
self._canv.remove(self._img)
AttributeError: _img brython.js:6408:18
No se puede reproducir el medio. No hay decodificadores para los
formatos solicitados: audio/x-wav, audio/x-wav, audio/x-wav index.html
No se puede reproducir el medio. No hay decodificadores para los
formatos solicitados: audio/x-wav index.html
1366 301
>> <https://groups.google.com/d/msgid/brython/61dd0f5f-f440-421c-82dc-ba57afa464b9n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "brython" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to brython+u...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/brython/CAF1%3DpD%3DJ%2BNjChPc7_KnpM3Ev_h1dKPPsg5RZ6ohna620gZf8eQ%40mail.gmail.com.
>

Pierre Quentel

unread,
Feb 2, 2021, 5:19:38 AM2/2/21
to brython
Very nice Victor, congratulations !
It works perfectly for me (only cards with a yellow border can be clicked on). I think it's going to take me hours to complete the game ;-)
- Pierre

Edward Elliott

unread,
Feb 2, 2021, 8:01:04 AM2/2/21
to bry...@googlegroups.com
It works for me now.  I think the problem before was that I had no valid moves on first draw.  So no cards were yellow and nothing would move.  Thought the game was broken. 😅

272 on my first finish.  Room for improvement.

Noticed some interesting patterns.  Many mathematical cycles involved - to place card A, need to move card B, which requires moving card C, .... which requires moving card A.  Which means those cards are stuck in place this round.  Would be interesting to program a solver that maps out the possibilities.

My productivity is definitely trending down...


--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.

Edward Elliott

unread,
Feb 2, 2021, 3:20:53 PM2/2/21
to bry...@googlegroups.com
How about 1356?  Is that a good score? 😏

solitaire-1356.jpg

I also do levitating card tricks.  No code was touched, no console was opened. 🧙🏻‍♂️ 💫 🕴🏻


levitation.jpg

solitaire-1356.jpg
levitation.jpg

Pierre Quentel

unread,
Feb 3, 2021, 3:21:16 AM2/3/21
to brython
Amazing score Edward ! My best is 320...
Victor, I have posted a tweet to present this extremely addictive game !
- Pierre

Edward Elliott

unread,
Feb 3, 2021, 5:38:10 AM2/3/21
to bry...@googlegroups.com
Your probably know, but for others : It's a bug. Max score should be 480. I can make my score arbitrarily high with the right sequence. 😁


Victor Norman

unread,
Feb 3, 2021, 10:29:34 AM2/3/21
to bry...@googlegroups.com
Oh boy... how are you seeing these problems? I wish I knew.

My wife and I have tested this "significantly" 🙂 and don't see any problems. How am I going to figure this out? Any ideas?

What browser are you using? I have been using Firefox and my wife, Chrome.

I also have used it on my Android phone with Chrome and it seems to work well.

From: bry...@googlegroups.com <bry...@googlegroups.com> on behalf of Edward Elliott <ese...@gmail.com>
Sent: Tuesday, February 2, 2021 3:20 PM
To: bry...@googlegroups.com <bry...@googlegroups.com>
Subject: Re: [brython] Re: For your enjoyment
 
You received this message because you are subscribed to a topic in the Google Groups "brython" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/brython/VARPVRveTig/unsubscribe.
To unsubscribe from this group and all its topics, send an email to brython+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/CAF1%3DpDnJrNOtq%2BzD0-Oo%2BnOjvyFbKQrGsDapvfk0xi-AhZs9MQ%40mail.gmail.com.

Edward Elliott

unread,
Feb 3, 2021, 6:36:17 PM2/3/21
to bry...@googlegroups.com
Hi Victor, 
Oh it works fine.  Just a few minor bugs, barely noticeable.  Actually they're quite charming, I prefer the game with them. 🙂

Happy to help track down the issues.  First, I wonder if you might be willing to share the source code?  The only brython I see on the website is "import main".  Where does the brython code live?  I'd like to see how this is done.

fabric.min.js seems to do most of the work of drawing the game, though i can't tell how complete it is in minified form.  The card graphics (png? svg?) don't seem to be in there.

Thanks for making and sharing.  My productivity may never recover. 😉
Edward


Andy Lewis

unread,
Feb 4, 2021, 12:24:59 PM2/4/21
to brython
Very nice game! I scored 427 on my first attempt - quite pleased, but there's room for improvement. I haven't worked out how to do tricks like Edward yet.

The brython code is presumably in a file called "main.py" which is run when it is imported - an interesting technique for hiding the code. Just as an experiment I've just tried it out on one of my games (not that I have any reason to hide the code).  All I did was change
<script type="text/python" src="polyominoes.py"></script>
into <script type="text/python">import polyominoes</script>
and everything worked exactly as before.

Thanks for sharing the game. Now to try and improve my score.

Andy



Victor Norman

unread,
Feb 4, 2021, 12:27:46 PM2/4/21
to bry...@googlegroups.com
Thanks. Yes, doing the import this way means I can give the students the index.html file and they never have to touch it for all their labs/homework. As long as they put the main part of the code in main.py.



From: bry...@googlegroups.com <bry...@googlegroups.com> on behalf of Andy Lewis <andy3...@gmail.com>
Sent: Thursday, February 4, 2021 12:24 PM
To: brython <bry...@googlegroups.com>

Subject: Re: [brython] Re: For your enjoyment
--
You received this message because you are subscribed to a topic in the Google Groups "brython" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/brython/VARPVRveTig/unsubscribe.
To unsubscribe from this group and all its topics, send an email to brython+u...@googlegroups.com.

Andy Lewis

unread,
Feb 4, 2021, 12:45:06 PM2/4/21
to brython
Hi Victor

Wouldn't that also be the case if you just had a line in the <head>  section of index.html: <script type="text/python" src="main.py"></script> ?

Andy

Victor Norman

unread,
Feb 4, 2021, 12:46:23 PM2/4/21
to bry...@googlegroups.com
Yes, I guess so. I didn't try that.


Sent: Thursday, February 4, 2021 12:45 PM

Andy Lewis

unread,
Feb 4, 2021, 1:11:20 PM2/4/21
to brython
Frustration.png

Yay! Second attempt is 480. I shall retire now! ;-)

Andy

Pierre Quentel

unread,
Feb 5, 2021, 3:29:05 AM2/5/21
to brython
May I suggest a minor improvement ? When a new game is started, avoid having a blank cell at the right of a king, and two consecutive blank cells. It makes the game harder, and maybe impossible at times.
A favicon would be nice also.
Still stuck on 320...

Edward Elliott

unread,
Feb 7, 2021, 8:50:05 AM2/7/21
to bry...@googlegroups.com
Hi Victor,
I think I reproduced the bug that prevented me from playing the first time.  No sure how though.

See screenshot of new game with Aces not removed.  There's one open square next to jack, but I can't move queen (far right) into it.  Thus no moves are possible.

Not sure how this happened.  I restarted my browser, and the page was still open from playing last night.  When I switched to that tab after restart, the game appeared as shown.  Perhaps a consequence of the page initially loading without focus in a background tab?

Also, my high scores were wiped.  Where are high scores stored?  Should use persistent browser storage for that.  Perhaps my browser settings cleared it on restart.

nomoves.jpg

--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/3b7d5e42-0c69-4a05-9534-7fcc2c5b809cn%40googlegroups.com.
nomoves.jpg

Edward Elliott

unread,
Feb 7, 2021, 8:54:47 AM2/7/21
to bry...@googlegroups.com
Quick update - the problem is more than just no moves.  None of the controls work either (no game, reload game).  It seems the script crashed while initializing the game.  Here's the console error from my chrome log:

upgrade needed
brython.js:9407 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
$download_module @ brython.js:9407
brython.js:13759 Warning: 'src' is a property of element.style
brython.js:13762 module main line 735
brython.js:13759 Warning: 'src' is a property of element.style
brython.js:13762 module main line 735
brython.js:13759 Warning: 'src' is a property of element.style
brython.js:13762 module main line 735
brython.js:13759 Warning: 'src' is a property of element.style
brython.js:13762 module main line 735
brython.js:6408 no playsounds in storage

brython.js:6408 Traceback (most recent call last):
  File VFS.browser.timer.py line 13, in f
    msg='{0.info}\n{0.__class__.__name__}: {0.args[0]}'.format(exc)
    self._card2ImgDict[id(card)].erase()
    self._canv.remove(self._img)
AttributeError: _img     @ brython.js:6408
brython.js:6408 1745 431


Reply all
Reply to author
Forward
0 new messages