Author |
Message |
|
Harrierfalcon The Raptor of Calcs
Super Elite (Last Title)
Joined: 25 Oct 2006 Posts: 2535
|
Posted: 15 Feb 2007 10:41:28 pm Post subject: |
|
|
Yuck. I've heard enough things about calculus already...but anyways...
----------------------------------------------------------------------------------------------------------------------------------------------------------
Teaser #10
Make the smallest program you can that shuffles a deck of cards. It should encompass both the value and suit of the card, in the format [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]value.suit, so Jack of Spades would be [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]11.1. The number for each suit is irrelevant. The shuffled deck should reside in [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]L1. The program size with a 1-letter title is the size needed.
----------------------------------------------------------------------------------------------------------------------------------------------------------
As of now, mine is 55 bytes. Can anyone beat it?
[color=#000000background#000000]
seq(Z+int((Z+12)/13)/10,Z,1,52->L1
int(99rand(52->L2
SortA(L2,L1
[/color]
Last edited by Guest on 15 Feb 2007 11:05:13 pm; edited 1 time in total |
|
Back to top |
|
|
alexrudd pm me if you read this
Bandwidth Hog
Joined: 06 Oct 2004 Posts: 2335
|
Posted: 15 Feb 2007 11:58:17 pm Post subject: |
|
|
Seq(X4-1,X,0,51->L1 ; -1 = negative one exponent key.
rand(52->L2
SortA(L2,L1
Don't know exact size, but I think I win. I've done this before in Poker.
Last edited by Guest on 16 Feb 2007 12:02:55 am; edited 1 time in total |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 16 Feb 2007 04:16:00 pm Post subject: |
|
|
That doesn't have the same format for suit, but as it has an equally useful one I don't think it matters. |
|
Back to top |
|
|
luby I want to go back to Philmont!!
Calc Guru
Joined: 23 Apr 2006 Posts: 1477
|
Posted: 16 Feb 2007 05:37:45 pm Post subject: |
|
|
bfr wrote: I would hope that finding the arithmetic-geometric mean wouldn't require calculus. :P
luby wrote: i is sqrt(-1) so if you do 3+4i it really is sqrt(-3^2+-4^2) The abs gets you the positive which is 5
[post="92780"]<{POST_SNAPBACK}>[/post]
I know this is an old quote, somebody might have already corrected this, but while I was reading through this thread, this just kind of stood out - it is wrong. "abs" is finding the distance from 3+4i to the origin on the real-imaginary number grid. It is not there just to make the answer postive (not trying to be really picky or rude, but that really just jumped out at me).
[post="97381"]<{POST_SNAPBACK}>[/post]
I cheated. If you find the abs of a real number, that is all you have to do. I shirked on the explination, and I am sorry. |
|
Back to top |
|
|
alexrudd pm me if you read this
Bandwidth Hog
Joined: 06 Oct 2004 Posts: 2335
|
Posted: 16 Feb 2007 05:44:06 pm Post subject: |
|
|
Quote: The number for each suit is irrelevant. For once, I actually read all the disclaimers. :)
Oh, and for really fast shuffling, add this to a getKey loop where a user won't notice any delay:
rand->L2(randInt(1,52
Then you can shuffle using this again without waiting for rand(52:
SortA(L2,L1
EDIT: Added to TI|BD.
Last edited by Guest on 16 Feb 2007 06:21:50 pm; edited 1 time in total |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 16 Feb 2007 06:30:05 pm Post subject: |
|
|
Is there a reason you're not just using [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]X/4? |
|
Back to top |
|
|
alexrudd pm me if you read this
Bandwidth Hog
Joined: 06 Oct 2004 Posts: 2335
|
Posted: 16 Feb 2007 06:32:42 pm Post subject: |
|
|
Um...
I was thinking in terms of .25 * X, and went from there.
-1 looks cooler.
X/4 is for noobs.
No, not really. Thanks for pointing it out. |
|
Back to top |
|
|
Harrierfalcon The Raptor of Calcs
Super Elite (Last Title)
Joined: 25 Oct 2006 Posts: 2535
|
Posted: 16 Feb 2007 08:19:14 pm Post subject: |
|
|
My routine didn't work anyways...hehehe.
Now that I have one that does work, it is a little larger, but also provides it in the format I suggested.
[color=#000000background#000000]
:seq(1+round(13fPart(Z/13),0)+int((Z+13)/13).1,Z,0,51->L1
:rand(52->L2
:SortA(L2,L1
[/color]
Any optimizations?
EDIT: alexrudd, could you PM me (so we don't get offtopic) the concept/routine to use to check for possible hands for your poker game?
Last edited by Guest on 16 Feb 2007 08:47:15 pm; edited 1 time in total |
|
Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)
Joined: 25 Nov 2004 Posts: 3976
|
Posted: 17 Feb 2007 12:54:27 am Post subject: |
|
|
[OPTIMIZATION]
(Z+13)/13 = Z/13+1
[/OPTIMIZATION]
Nice. That's pretty close to what I came up with for this format.
Last edited by Guest on 08 Dec 2007 08:17:20 am; edited 1 time in total |
|
Back to top |
|
|
Harrierfalcon The Raptor of Calcs
Super Elite (Last Title)
Joined: 25 Oct 2006 Posts: 2535
|
Posted: 17 Feb 2007 01:12:01 am Post subject: |
|
|
0_o
I'm close to one of Weregoose's routines...:|
Yeah, I noticed that optimization about 5 minutes after posting it. |
|
Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)
Joined: 25 Nov 2004 Posts: 3976
|
Posted: 17 Feb 2007 02:23:55 am Post subject: |
|
|
But, you can take it further like so:
Spoiler wrote: [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]1.1+seq(13fPart(Z)+.1int(Z),Z,0,4,13‾¹→L1 It saves seven more bytes.
Last edited by Guest on 17 Feb 2007 02:27:32 am; edited 1 time in total |
|
Back to top |
|
|
georgexu
Newbie
Joined: 09 Feb 2007 Posts: 34
|
Posted: 17 Feb 2007 11:37:37 pm Post subject: |
|
|
I tried it, nearly impossible, I got 24 bytes. Ive shortened everything... |
|
Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)
Joined: 25 Nov 2004 Posts: 3976
|
Posted: 17 Feb 2007 11:39:50 pm Post subject: |
|
|
...If you don't mind, concerning what challenge did you just reply?
Last edited by Guest on 17 Feb 2007 11:40:22 pm; edited 1 time in total |
|
Back to top |
|
|
Neekstar
Advanced Newbie
Joined: 14 Dec 2006 Posts: 75
|
Posted: 20 Feb 2007 11:13:45 am Post subject: |
|
|
I think he's talking about the one from the very first post. |
|
Back to top |
|
|
Harrierfalcon The Raptor of Calcs
Super Elite (Last Title)
Joined: 25 Oct 2006 Posts: 2535
|
Posted: 22 Feb 2007 09:26:19 pm Post subject: |
|
|
Maybe...don't worry people, I've asked this teaser because I 1)was going to use it in a game and 2) I wanted to see if anyone could optimize my routine. I was expecting Goose to, because....well....it's Goose. Come on.
You'll see this implemented very soon, depending on when DarkerLine uploads my most recent game... |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 22 Feb 2007 09:47:29 pm Post subject: |
|
|
You don't expect me to be on 24 hours a day, do you? Because if you do, then... well...
oh, who am I kidding? I have nothing better to do anyway, so you might as well expect me to be on 24 hours a day... |
|
Back to top |
|
|
luby I want to go back to Philmont!!
Calc Guru
Joined: 23 Apr 2006 Posts: 1477
|
Posted: 22 Feb 2007 10:21:48 pm Post subject: |
|
|
And if you're not, you probably are doing something that is required for life (eating, sleeping{short naps}, going to the bathroom, paying bills)
I go with calc capture also.
Last edited by Guest on 22 Feb 2007 10:22:17 pm; edited 1 time in total |
|
Back to top |
|
|
|