Bucket: A simple betting card game

About programming and getting involved with Linux Mint development
User avatar
christosangelopoulos
Level 3
Level 3
Posts: 140
Joined: Fri Nov 13, 2020 10:19 pm

Re: Bucket: A simple betting card game

Post by christosangelopoulos »

Drugwash wrote:
Tue Nov 22, 2022 10:30 am
Thanks, little things like that tend to bu gme more than the important ones sometimes. :D
Accordng to those links that I have posted before
https://linguaholic.com/linguablog/doll ... er-number/
https://grammarhow.com/euro-symbol-befo ... er-number/
it is a general convention in the english language to write the currency before the amount. And since (as a matter of convention) we use the english language, we might as well follow this currency convention. I can only guess that the slider mousewheel functionality not working has to do with the fact that inside the function nameSum two variables are defined by a string that contains a currency symbol. Since the .replace expects to keep everything after a character:
totalSum = Number(document.querySelector("#total").innerHTML.replace(/.*\: ./, ''));
var sum = Number(document.querySelector("#placedBet").innerHTML.replace(/./, ''));

(replace the first character (/./), the one that is expected a currency symbol, with nothing ('')).
The replace should get rid of the LAST character (since you prefer the currency symbol at the end, that means that the lasta character is the currency symbol.
Try replace(/.$/, '')) It should do just that.

At some point, why not go big: Prepare multi-language dialogs. There the position of the currency symbol will be what is usual in that language.
Drugwash wrote:
Tue Nov 22, 2022 10:30 am

I suppose it has something to do with CSS styling which I hate for even existing. :evil:
CSS is not my cup of tea as mentioned above.
Well there are some ready-made solutions for checkboxes, for instance:
https://www.w3docs.com/snippets/css/how ... h-css.html
I haven't implement them because I had bigger fish to fry, I might do it and be done with this.
css is not my cup of tea either, but since we are here, might as well face the music and dance !:lol:
Drugwash wrote:
Tue Nov 22, 2022 10:30 am
Maybe a review of the features would be in order just to make sure there won't be any further overhaul involved later on.
Also the code structure may need some tweaking, for example certain frequently used variables (i.e. sum, totalSum) should be made global in order to avoid requesting them repeatedly in multiple functions.
I take full responsibity of the bad coding practices. My inexperience in programming, my total inexperience with js (wrote Hello world last year, nearly never touched it again since) and the need to implement things in a "proof of concept" level led to dirty code.
However, I guess that moving to Python will solve many issues, and create others. We will see... :roll:
User avatar
christosangelopoulos
Level 3
Level 3
Posts: 140
Joined: Fri Nov 13, 2020 10:19 pm

Re: Bucket: A simple betting card game

Post by christosangelopoulos »

christosangelopoulos wrote:
Tue Nov 22, 2022 1:37 pm
Try replace(/.$/, '')) It should do just that.
Well that works in one-character currency symbols. I just saw that the romanian currency is three characters long, so in that case the line above will not work. Howeve, an if statement can take care of that ( if coin length is 3, {.....replace(/...$/, ''). Dirty, but should work fine.
User avatar
Drugwash
Level 5
Level 5
Posts: 680
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: Bucket: A simple betting card game

Post by Drugwash »

christosangelopoulos wrote:
Tue Nov 22, 2022 1:37 pm
I can only guess that the slider mousewheel functionality not working has to do with the fact that inside the function nameSum two variables are defined by a string that contains a currency symbol.
That is no longer the case in my mod since I replaced the .replace with .match so that it only retrieves the digits anywhere they may be placed in the string. Even made a function out of it to avoid repetition. You didn't check the code carefully. 8)
christosangelopoulos wrote:
Tue Nov 22, 2022 1:37 pm
At some point, why not go big: Prepare multi-language dialogs. There the position of the currency symbol will be what is usual in that language.
That would be doable but it's been a while since I'm kinda against this complete AI-like "guessing". It may work for the bulk of the users but there may be the odd one (like myself) who uses mixed settings and their system could get confused or fail to provide the desired options. I'd rather have a manual way of choosing the option, to make sure it looks and works precisely as I want howewer weird it may seem. :wink: I mean I have my system in English and measurements may not all be set properly so the symbol may pop up in front of the sum, while natively in my country the symbol is placed after the sum. If I left the system to do its bidding I would be frustrated as much as I was when there was no option to switch its position. So better leave it to the user, that way there would be no guessing - and therefore no error - involved. 8)
christosangelopoulos wrote:
Tue Nov 22, 2022 1:37 pm
css is not my cup of tea either, but since we are here, might as well face the music and dance ! :lol:
Oh please, be my guest. Dance away! (Zorba style...?) :lol:
christosangelopoulos wrote:
Tue Nov 22, 2022 1:37 pm
I take full responsibity of the bad coding practices. My inexperience in programming, my total inexperience with js (wrote Hello world last year, nearly never touched it again since) and the need to implement things in a "proof of concept" level led to dirty code.
Oh remember that song that used to repeat "shut up and dance"...? :D I never took programming classes or anything, just played with computers at will in a completely amateurish way. Incidentally managed to achieve interesting results that others wouldn't have dreamt of. So stop underappreciating yourself and get down to work! 8)
christosangelopoulos wrote:
Tue Nov 22, 2022 1:37 pm
However, I guess that moving to Python will solve many issues, and create others.
Your guess is right on the money! :lol: :lol: :lol:
User avatar
christosangelopoulos
Level 3
Level 3
Posts: 140
Joined: Fri Nov 13, 2020 10:19 pm

Re: Bucket: A simple betting card game

Post by christosangelopoulos »

Drugwash wrote:
Tue Nov 22, 2022 1:54 pm
You didn't check the code carefully. 8)
I never said I did! :lol:
Drugwash wrote:
Tue Nov 22, 2022 1:54 pm
...get down to work! 8)
Hey I already have a boss! I am married! :lol: :lol: :lol:
User avatar
Drugwash
Level 5
Level 5
Posts: 680
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: Bucket: A simple betting card game

Post by Drugwash »

christosangelopoulos wrote:
Tue Nov 22, 2022 2:22 pm
I never said I did! :lol:
True. :P
christosangelopoulos wrote:
Tue Nov 22, 2022 2:22 pm
Hey I already have a boss! I am married! :lol: :lol: :lol:
Ah then you don't need another father-in-law. :lol: :lol: :lol:
User avatar
christosangelopoulos
Level 3
Level 3
Posts: 140
Joined: Fri Nov 13, 2020 10:19 pm

Re: Bucket: A simple betting card game

Post by christosangelopoulos »

Drugwash wrote:
Tue Nov 22, 2022 1:54 pm
... get down to work! 8)
Well, after a little work,
  • I incorporated the select cureency format feature (coin before/after sum)
  • I improved a little the spaghetti carbonara that is my code (a bit more combing coming later on, nothing borked)
  • I improved the checkbox style, now it should be more relevant to the rest of the page
Image
css is a pain (everything is a pain when you are ignorant, but still, css is a pain)
I began checking gtk...
User avatar
Drugwash
Level 5
Level 5
Posts: 680
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: Bucket: A simple betting card game

Post by Drugwash »

Checkboxes are OK now in Falkon and Midori, albeit slightly too large (for my setup at least).
But no autoloading settings, no Lei? Ah, fork it! :roll: (again) :)
User avatar
christosangelopoulos
Level 3
Level 3
Posts: 140
Joined: Fri Nov 13, 2020 10:19 pm

Re: Bucket: A simple betting card game

Post by christosangelopoulos »

Drugwash wrote:
Fri Nov 25, 2022 4:23 pm
But no autoloading settings, no Lei? Ah, fork it! :roll: (again) :)
Don't fork it just yet, more updates to come tomorrow! :lol:
I'll probably fix the checkbox sizes too...
User avatar
Drugwash
Level 5
Level 5
Posts: 680
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: Bucket: A simple betting card game

Post by Drugwash »

Ah, delight...!Chasing Liberty (2004) ) A programmer's work is never done, is it... :D
Oh well, I'll wait, just because I got some hardware issues to deal with right now. :P
User avatar
christosangelopoulos
Level 3
Level 3
Posts: 140
Joined: Fri Nov 13, 2020 10:19 pm

Re: Bucket: A simple betting card game

Post by christosangelopoulos »

Drugwash wrote:
Fri Nov 25, 2022 6:09 pm
A programmer's work is never done, is it... :D
Updated, changed logic a little, clleaned up thecode a little bit, variable and folder names, updated style, improved responsiveness.
I tried to keep the logic in good shape, so that I have the least amount of headaches while moving to Python...
There is no symbol for lei, sorry, you might want to add lei manually.
Also, you can add the auto load functionality that works for your browser.
let me know iis all appear ok (or not!)
Fork away! :D
User avatar
Drugwash
Level 5
Level 5
Posts: 680
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: Bucket: A simple betting card game

Post by Drugwash »

Yeah, I love the concept "if you want something done do it yourself", it's been the inspiration of my life. :)
Well, the lei currency had already been added and it required quite a few changes in the code in order to accomodate its lack of a single symbol. Nevermind, I'll do it again... and again... and again... (I love repetition, see... :roll: )
Auto load is a must, the lack of it in "major" browsers is a major downside, people may be put off by that. Guess I'm lucky. :roll:
So, on to the fork and spoon(ing the code)! 8)
User avatar
christosangelopoulos
Level 3
Level 3
Posts: 140
Joined: Fri Nov 13, 2020 10:19 pm

Re: Bucket: A simple betting card game

Post by christosangelopoulos »

Drugwash wrote:
Sun Nov 27, 2022 4:43 pm
Yeah, I love the concept "if you want something done do it yourself", it's been the inspiration of my life. :)
Well, the lei currency had already been added and it required quite a few changes in the code in order to accomodate its lack of a single symbol. Nevermind, I'll do it again... and again... and again... (I love repetition, see... :roll: )
Auto load is a must, the lack of it in "major" browsers is a major downside, people may be put off by that. Guess I'm lucky. :roll:
So, on to the fork and spoon(ing the code)! 8)
There are two objections for me to adopt your suggestions about auto-loading:
  • Any "major" browser will give an error message. I don't want to have any errors while executing, it would nag me very much :x :lol:
  • I will have to accept the convention of this language. This is why I am considering moving it elsewhere. And of course it is a good opportunity to get to learn a few more things.
Instead of getting mad about js's given difficulty with the file system, (that I could easily surpass with node btw), I intend to find a more constructive and educative way to approach the issue. Cleaning up the code, building and connecting things properly, seems more important to me, being a novice and all. I made some changes that to me at least make more sense. And it is a process, it is not over just yet...
I am also trying to apply what I have done here to to Blackjack. CSS haunts and torments me :x :x :lol:
User avatar
Drugwash
Level 5
Level 5
Posts: 680
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: Bucket: A simple betting card game

Post by Drugwash »

christosangelopoulos wrote:
Sun Nov 27, 2022 5:58 pm
Any "major" browser will give an error message.
What kind of error, more precisely? Is it something visible to the user or just in the browser console? If the latter then don't sweat it, any installed extensions and/or webpages will sooner or later litter the console with warnings and errors anyway.
christosangelopoulos wrote:
Sun Nov 27, 2022 5:58 pm
I will have to accept the convention of this language.
I for one refuse to accept the conventions arbitrarily implemented by some <...> people that believe the word "security" gives them the right to screw up entire workflows, ergonomics, muscle memory and so on.
christosangelopoulos wrote:
Sun Nov 27, 2022 5:58 pm
I made some changes that to me at least make more sense.
Me too. Autoloading user-defined settings is critical for any decent application. Imagine if your browser reverted to defaults each and every time you start it, and you'd have to remember and reset all your preferences one after another, again and again and again and... you get the drill.
Tell you the truth: if I couldn't have implemented autoload I would've ditched this app right away. My mind refuses compromises that shouldn't even be on the table. Yeah, I'm such a SOB. :twisted:

So you code away, learn things, it's fun. I'll keep cracking this nut until it's open or crumbles into dust. :D Good luck! 8)
User avatar
christosangelopoulos
Level 3
Level 3
Posts: 140
Joined: Fri Nov 13, 2020 10:19 pm

Re: Bucket: A simple betting card game

Post by christosangelopoulos »

Drugwash wrote:
Sun Nov 27, 2022 7:38 pm

Tell you the truth: if I couldn't have implemented autoload I would've ditched this app right away. My mind refuses compromises that shouldn't even be on the table. Yeah, I'm such a SOB. :twisted:

So you code away, learn things, it's fun. I'll keep cracking this nut until it's open or crumbles into dust. :D Good luck! 8)
Hey let's be honest with ourselves, we all know by now why you keep playing :lol: :P :wink:
Image
User avatar
Drugwash
Level 5
Level 5
Posts: 680
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: Bucket: A simple betting card game

Post by Drugwash »

No time for playing, too busy fixing your code. :P :D
bucket_fix_2022.11.28.zip
(10.41 KiB) Downloaded 2 times
User avatar
christosangelopoulos
Level 3
Level 3
Posts: 140
Joined: Fri Nov 13, 2020 10:19 pm

Re: Bucket: A simple betting card game

Post by christosangelopoulos »

Drugwash wrote:
Mon Nov 28, 2022 12:56 am
No time for playing, too busy fixing your code. :P :D

bucket_fix_2022.11.28.zip
You canot fix something if it is not broken. You can only break it :lol: :lol:
User avatar
Drugwash
Level 5
Level 5
Posts: 680
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: Bucket: A simple betting card game

Post by Drugwash »

Here you go, shredded to pieces:
bucket-main_files_only_2022.11.28_15.42.zip
(11.67 KiB) Downloaded 4 times
- added (again) automatic loading of preferences at startup (for browsers that allow it)
- added automatic detection and conversion of old preferences
- improved appearance of certain elements in the Settings page

Sorry for taking me so long to improve on perfection... :P :lol:
User avatar
christosangelopoulos
Level 3
Level 3
Posts: 140
Joined: Fri Nov 13, 2020 10:19 pm

Re: Bucket: A simple betting card game

Post by christosangelopoulos »

Drugwash wrote:
Mon Nov 28, 2022 9:59 am
Here you go, shredded to pieces:
bucket-main_files_only_2022.11.28_15.42.zip

- added (again) automatic loading of preferences at startup (for browsers that allow it)
- added automatic detection and conversion of old preferences
- improved appearance of certain elements in the Settings page

Sorry for taking me so long to improve on perfection... :P :lol:
:lol: :lol: :lol:
Image
User avatar
Drugwash
Level 5
Level 5
Posts: 680
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: Bucket: A simple betting card game

Post by Drugwash »

If that bucket is full of uzo I'll take it. :lol: :lol: :lol:
Post Reply

Return to “Programming & Development”