Jump to content

Deal cards for FreeCell: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 1,101:
♦J ♠K ♣K ♥4
</pre>
 
 
=={{header|F#}}==
Line 1,213 ⟶ 1,212:
JD KS KC 4H
</pre>
 
=={{header|Fōrmulæ}}==
 
In [http://wiki.formulae.org/Deal_cards_for_FreeCell this] page you can see the solution of this task.
 
Fōrmulæ programs are not textual, visualization/edition of programs is done showing/manipulating structures but not text ([http://wiki.formulae.org/Editing_F%C5%8Drmul%C3%A6_expressions more info]). Moreover, there can be multiple visual representations of the same program. Even though it is possible to have textual representation &mdash;i.e. XML, JSON&mdash; they are intended for transportation effects more than visualization and edition.
 
The option to show Fōrmulæ programs and their results is showing images. Unfortunately images cannot be uploaded in Rosetta Code.
 
=={{header|Fortran}}==
Line 1,380 ⟶ 1,371:
4S TS 2H 5D JC 6C JH QH
JD KS KC 4H</pre>
 
=={{header|Fōrmulæ}}==
 
In [http://wiki.formulae.org/Deal_cards_for_FreeCell this] page you can see the solution of this task.
 
Fōrmulæ programs are not textual, visualization/edition of programs is done showing/manipulating structures but not text ([http://wiki.formulae.org/Editing_F%C5%8Drmul%C3%A6_expressions more info]). Moreover, there can be multiple visual representations of the same program. Even though it is possible to have textual representation &mdash;i.e. XML, JSON&mdash; they are intended for transportation effects more than visualization and edition.
 
The option to show Fōrmulæ programs and their results is showing images. Unfortunately images cannot be uploaded in Rosetta Code.
 
=={{header|Go}}==
Line 2,489 ⟶ 2,488:
print "Hand $hand_idx\n";
print $string;</lang>
 
=={{header|Perl 6}}==
{{works with|rakudo|2016.05}}
<lang perl6>sub dealgame ($game-number = 1) {
sub ms-lcg-method($seed = $game-number) { ( 214013 * $seed + 2531011 ) % 2**31 }
 
# lazy list of the random sequence
my @ms-lcg = |(&ms-lcg-method ... *).map: * +> 16;
 
constant CardBlock = '🂠'.ord;
my @deck = gather for flat(1..11,13,14) X+ (48,32...0) -> $off {
take chr CardBlock + $off;
}
 
my @game = gather while @deck {
@deck[@ms-lcg.shift % @deck, @deck-1] .= reverse;
take @deck.pop;
}
 
say "Game #$game-number";
say @game.splice(0, 8 min +@game) while @game;
}
 
dealgame;
dealgame 617;</lang>
{{out}}
<big><big><pre>Game #1
🃋 🃂 🂹 🃛 🃅 🂷 🃗 🂵
🃎 🃞 🂩 🂥 🃁 🃝 🂾 🂳
🂢 🂮 🃉 🃍 🂫 🂡 🂱 🃓
🃔 🃕 🂪 🂽 🂴 🃑 🃄 🂧
🂣 🃊 🂤 🂺 🂸 🃒 🂻 🃇
🃆 🂨 🃈 🂭 🃖 🃃 🃘 🃚
🂦 🃙 🂲 🂶
Game #617
🃇 🃁 🃕 🂣 🂥 🃘 🃂 🂱
🃊 🂧 🃍 🃑 🃆 🂸 🂡 🂾
🂺 🃝 🂳 🃉 🂦 🃈 🃃 🃚
🃎 🂵 🂩 🃓 🂨 🂷 🃄 🂫
🃔 🂭 🃙 🂹 🃗 🂶 🃒 🂢
🂤 🂪 🂲 🃅 🃛 🃖 🂻 🂽
🃋 🂮 🃞 🂴</pre></big></big>
 
=={{header|Phix}}==
Line 2,901 ⟶ 2,858:
4S TS 2H 5D JC 6C JH QH
JD KS KC 4H</pre>
 
=={{header|Raku}}==
(formerly Perl 6)
{{works with|rakudo|2016.05}}
<lang perl6>sub dealgame ($game-number = 1) {
sub ms-lcg-method($seed = $game-number) { ( 214013 * $seed + 2531011 ) % 2**31 }
 
# lazy list of the random sequence
my @ms-lcg = |(&ms-lcg-method ... *).map: * +> 16;
 
constant CardBlock = '🂠'.ord;
my @deck = gather for flat(1..11,13,14) X+ (48,32...0) -> $off {
take chr CardBlock + $off;
}
 
my @game = gather while @deck {
@deck[@ms-lcg.shift % @deck, @deck-1] .= reverse;
take @deck.pop;
}
 
say "Game #$game-number";
say @game.splice(0, 8 min +@game) while @game;
}
 
dealgame;
dealgame 617;</lang>
{{out}}
<big><big><pre>Game #1
🃋 🃂 🂹 🃛 🃅 🂷 🃗 🂵
🃎 🃞 🂩 🂥 🃁 🃝 🂾 🂳
🂢 🂮 🃉 🃍 🂫 🂡 🂱 🃓
🃔 🃕 🂪 🂽 🂴 🃑 🃄 🂧
🂣 🃊 🂤 🂺 🂸 🃒 🂻 🃇
🃆 🂨 🃈 🂭 🃖 🃃 🃘 🃚
🂦 🃙 🂲 🂶
Game #617
🃇 🃁 🃕 🂣 🂥 🃘 🃂 🂱
🃊 🂧 🃍 🃑 🃆 🂸 🂡 🂾
🂺 🃝 🂳 🃉 🂦 🃈 🃃 🃚
🃎 🂵 🂩 🃓 🂨 🂷 🃄 🂫
🃔 🂭 🃙 🂹 🃗 🂶 🃒 🂢
🂤 🂪 🂲 🃅 🃛 🃖 🂻 🂽
🃋 🂮 🃞 🂴</pre></big></big>
 
=={{header|REXX}}==
10,327

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.