Talk:Deal cards for FreeCell

From Rosetta Code
Revision as of 23:33, 11 June 2015 by rosettacode>Gerard Schildberger (→‎equation clarification: added a new talk section.)

task?

I see that although shuffle is not specified we have two implementations. But I have no way of knowing if they are correct implementations. Perhaps we should have an example? With this starting seed, we have this deck of cards? --Rdm 11:15, 19 September 2011 (UTC)

Example

I know this doesn't give the shuffle algorithm but ... it gives the result for seed=1 [1] and appears compatible with [2]

  1  2  3  4  5  6  7  8
 JD 2D 9H JC 5D 7H 7C 5H
 KD KC 9S 5S AD QC KH 3H
 2S KS 9D QD JS AS AH 3C
 4C 5C TS QH 4H AC 4D 7S
 3S TD 4S TH 8H 2C JH 7D
 6D 8S 8D QS 6C 3D 8C TC
 6S 9C 2H 6H

There is a reference to the shuffle algorithm here [3]

--Dgamey 14:26, 19 September 2011 (UTC)

32 bit Perl fix

The sample code for Perl works for perl 5.16 64 bit but not for perl 5.8 32 bit (e.g. game# 1070). This fix works for both.

#       return (($s = ($s * 214013 + 2531011) & 0x7fffffff) >> 16 );
        return (($s = ($s * 214013 + 2531011) % 2**31     ) >> 16 ); # fix for 32 bit perl

equation clarification

The equation:

  •  

should probably read

  •  

to indicate that the modulus is for the entire equation, not just the last term;   even though by inspection, it becomes obvious what was meant. -- Gerard Schildberger (talk) 23:33, 11 June 2015 (UTC)