Talk:Deal cards for FreeCell: Difference between revisions

→‎support for negative games: added a query concerning some versions of Windows FreeCell.
(Under-tested cosmetic edits of 21:04, 15 May 2016 left formulae invisible)
(→‎support for negative games: added a query concerning some versions of Windows FreeCell.)
 
(4 intermediate revisions by 2 users not shown)
Line 38:
 
Under-tested cosmetic edits made to the task page at 21:04, 15 May 2016, including the injection of spaces around expressions in <math> tags, have left some or all of the task description formulae completely invisible to all browsers which display the graphic file version of formulae rather than processing the MathML (this is, in fact, the majority of browsers). The MediaWiki processor does not currently expect such spaces, and generates syntactically ill-formed HTML if they are introduced. Other aspects of these cosmetic edits may further compound the problem. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 18:59, 22 September 2016 (UTC)
 
: Lost visibility now restored [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 15:28, 21 November 2016 (UTC)
 
==support for negative games==
Most people aren't aware of FreeCell's undocumented support for:
:::*   game   -1       and
:::*   game   -2
 
 
Windows 7 (and up) have undocumented support for two additional games:
:::*   game   -3       and
:::*   game   -4
 
 
You can't possibly win games    -1   and   -2.
 
You can't possibly lose games   -3   and   -4.
 
 
It is entertaining to watch the   -3   and   -4   games play out.
 
 
By the way, I'd be interested if Windows Vista supports games   -3   and   -4.
<br>Also, I'd be interested if Windows 8 (and higher) support more negative games.
 
 
 
Here is a REXX version that supports those (minus) games:
<lang rexx>/*REXX program deals cards for a specific FreeCell solitaire card game (0 ──► 32767).*/
numeric digits 15 /*ensure enough digits for the random #*/
parse arg game cols . /*obtain optional arguments from the CL*/
if game=='' | game=="," then game=1 /*No game specified? Then use default.*/
if cols=='' | cols=="," then cols=8 /* " cols " " " " */
state=game /*seed random # generator with game num*/
suit= '♣♦♥♠' /*default: ASCII symbols for the suits.*/
if game< -1 then suit= '♠♥♦♣' /*special suit order for games -2 -3 -4*/
 
rank= 'A23456789tJQK' /*t in the rank represents a ten (10).*/
if game==-1 then rank= 'AQ3t587694J2K' /*a special rank for a game of -1. */
if game==-2 then rank= 'A7K6Q5J4t3928' /*" " " " " " " -2. */
if game==-3 then rank= 'K6Q5J4t3928A7' /*" " " " " " " -3. */
 
minus4= space('K♣Q♣t♦8♥6♣5♦3♣2♦ K♥J♣t♣8♦6♥5♣3♥2♣ K♦J♦9♣8♣6♦4♣3♦A♣ K♣J♦9♥7♣6♣4♥3♣A♥' ,
'Q♣J♣9♦7♥5♣4♦2♣A♦ Q♥t♣9♣7♦5♦4♣2♥A♣ Q♦t♥8♣7♣', 0) /*tableau for game= -4*/
 
if 8=='f8'x then do /*EBCDIC? Then use letters for suits. */
suit =translate(suit, "cdhs", suit)
minus4=translate(minus4, "cdhs", suit)
end
pad=left('', 13) /*used for indentation for the tableau.*/
say center('tableau for FreeCell game' game, 50, "─") /*show title for FreeCell game #*/
say /* [↓] @ is an array of all 52 cards.*/
#=-1; do r=1 for length(rank) /*build the deck first by the rank. */
do s=1 for length(suit); #=#+1 /* " " " secondly " " suit. */
@.#=substr(rank, r,1)substr(suit, s,1) /*build the $ array one card at at time*/
end /*s*/ /* [↑] first card is number 0 (zero).*/
end /*r*/ /* [↑] build deck per FreeCell rules. */
$=pad /*@: cards to be dealt, eight at a time*/
r=1
s=0; do cards=51 by -1 for 52; s=s + 1 /* [↓] deal the cards for the tableau.*/
?=rand() // (cards + 1) /*get next rand#; card # is remainder.*/
 
if game<0 & game>-4 then $=$ nega() /*handle special for games -1, -2, -3 */
if game=-4 then $=$ neg4() /* " " " game -4 */
 
if game>=0 then $=$ @.?; @.?= @.cards /*swap two cards: use random and last.*/
 
if words($)==cols then do; say $; $=pad /*deal FreeCell cards for the tableau. */
end
end /*cards*/ /*normally, 8 cards are dealt to a row.*/
/* [↓] residual cards may exist. */
if $\='' then say $ /*Any residual cards in the tableau ? */
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
rand: state=(214013*state + 2531011) // 2**31; return state % 2**16 /*FreeCell rand#*/
nega: if s==5 then do; r=r+1; s=1; end; return substr(rank,r,1)substr(suit,s,1)
neg4: return substr(minus4, s+s-1, 2)</lang>
{{out|output|text=&nbsp; when using the input of: &nbsp; <tt> -1 </tt>}}
<pre>
───────────tableau for FreeCell game -1───────────
 
A♣ A♦ A♥ A♠ Q♣ Q♦ Q♥ Q♠
3♣ 3♦ 3♥ 3♠ t♣ t♦ t♥ t♠
5♣ 5♦ 5♥ 5♠ 8♣ 8♦ 8♥ 8♠
7♣ 7♦ 7♥ 7♠ 6♣ 6♦ 6♥ 6♠
9♣ 9♦ 9♥ 9♠ 4♣ 4♦ 4♥ 4♠
J♣ J♦ J♥ J♠ 2♣ 2♦ 2♥ 2♠
K♣ K♦ K♥ K♠
</pre>
{{out|output|text=&nbsp; when using the input of: &nbsp; <tt> -2 </tt>}}
<pre>
───────────tableau for FreeCell game -2───────────
 
A♠ A♥ A♦ A♣ 7♠ 7♥ 7♦ 7♣
K♠ K♥ K♦ K♣ 6♠ 6♥ 6♦ 6♣
Q♠ Q♥ Q♦ Q♣ 5♠ 5♥ 5♦ 5♣
J♠ J♥ J♦ J♣ 4♠ 4♥ 4♦ 4♣
t♠ t♥ t♦ t♣ 3♠ 3♥ 3♦ 3♣
9♠ 9♥ 9♦ 9♣ 2♠ 2♥ 2♦ 2♣
8♠ 8♥ 8♦ 8♣
</pre>
{{out|output|text=&nbsp; when using the input of: &nbsp; <tt> -3 </tt>}}
<pre>
───────────tableau for FreeCell game -3───────────
 
K♠ K♥ K♦ K♣ 6♠ 6♥ 6♦ 6♣
Q♠ Q♥ Q♦ Q♣ 5♠ 5♥ 5♦ 5♣
J♠ J♥ J♦ J♣ 4♠ 4♥ 4♦ 4♣
t♠ t♥ t♦ t♣ 3♠ 3♥ 3♦ 3♣
9♠ 9♥ 9♦ 9♣ 2♠ 2♥ 2♦ 2♣
8♠ 8♥ 8♦ 8♣ A♠ A♥ A♦ A♣
7♠ 7♥ 7♦ 7♣
</pre>
{{out|output|text=&nbsp; when using the input of: &nbsp; <tt> -4 </tt>}}
<pre>
───────────tableau for FreeCell game -4───────────
 
K♣ Q♣ t♦ 8♥ 6♣ 5♦ 3♣ 2♦
K♥ J♣ t♣ 8♦ 6♥ 5♣ 3♥ 2♣
K♦ J♦ 9♣ 8♣ 6♦ 4♣ 3♦ A♣
K♣ J♦ 9♥ 7♣ 6♣ 4♥ 3♣ A♥
Q♣ J♣ 9♦ 7♥ 5♣ 4♦ 2♣ A♦
Q♥ t♣ 9♣ 7♦ 5♦ 4♣ 2♥ A♣
Q♦ t♥ 8♣ 7♣
</pre>