Miniscule Poker Hand Shuffler
Author |
Message |
MEINsweeze
![](http://compsci.ca/v3/uploads/user_avatars/810028047603ec3af0e68a.png)
|
Posted: Tue Mar 02, 2021 5:48 pm Post subject: Miniscule Poker Hand Shuffler |
|
|
another submission, this one isn't very fancy, just small!
back in high school, my friend and i wanted to know which language was more compact.
we both made programs that shuffle a deck of cards and then give you the first 5
he did his in java in about 800 bytes, i did it in turing in around 650 (3-4 years later and we both still use our respective languages for side projects lmao)
since then, i've learned so much more about turing and tuned it to the point where i've spent an hour staring at it, trying to find a chink in the armour to get rid of another byte. i can't find anything else, so i'm deciding to publish it here!
it's a minuscule 390 bytes, and is as minimalist as i could possibly make it
of course, because of its compressed size, it's nearly illegible and has terrible terrible formatting...
i'll put it here too since it's not exactly bulky!
code: | var A,B,C:=0var D:array 1..13,1..4 of boolean var G:array 1..13of string for E:1..13for F:1..4D(E,F):=true end for G(E):=intstr(E)end for G(1):="A"G(11):="J"G(12):="Q"G(13):="K"var H:array 1..4of string:=init("h","d","c","s")var I:array 1..52of string loop exit when C=52randint(B,1,4)randint(A,1,13)if D(A,B)then C+=1I(C):=G(A)+H(B)D(A,B):=false end if end loop for J:1..5put I(J)end for |
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
picopoker.t |
Filesize: |
390 Bytes |
Downloaded: |
172 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
scholarlytutor
![](http://compsci.ca/v3/uploads/user_avatars/1625682006192930720d11.png)
|
Posted: Fri Mar 05, 2021 4:02 pm Post subject: Re: Miniscule Poker Hand Shuffler |
|
|
Wow, you're definitely a pro at keeping files small in terms of bytes. And it works well. The main drawback is that it's hard to read: the formatting, as you said, and also the single letter variable names. But your goal here was for the code to be compact, not readability.
I decided to challenge myself and make something similar in my 'style' of coding, and it's over 800 bytes! I'm sure I can make improvements, but I wrote it in under 30 minutes.
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
Card Shuffle.t |
Filesize: |
857 Bytes |
Downloaded: |
155 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Worxmdom
|
Posted: Thu Jul 04, 2024 6:43 pm Post subject: RE:Miniscule Poker Hand Shuffler |
|
|
Keep up the great work with your projects!
|
|
|
|
|
![](images/spacer.gif) |
Paystaren
|
Posted: Fri Jul 05, 2024 5:51 am Post subject: RE:Miniscule Poker Hand Shuffler |
|
|
I was doing a similar thing back in school, trying to optimize code, and every byte you cut feels like a mini victory. My friend and I once spent a whole weekend optimizing our code and ended up staying up late, fueled by a steady supply of energy drinks and snacks. At one point, we took a break and ended up at a local casino. We played a few rounds of cards and enjoyed the lively atmosphere. It was a place called Panen123 - a casino site with good vibes. While I'm more of a coding enthusiast, those random nights out really add flavor to the grind.
|
|
|
|
|
![](images/spacer.gif) |
|
|