Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
41
Task/Playing-cards/EasyLang/playing-cards.easy
Normal file
41
Task/Playing-cards/EasyLang/playing-cards.easy
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
global deck[] top .
|
||||
proc new . .
|
||||
deck[] = [ ]
|
||||
for i to 52
|
||||
deck[] &= i
|
||||
.
|
||||
top = 52
|
||||
.
|
||||
suit$[] = [ "♠" "♦" "♥" "♣" ]
|
||||
val$[] = [ 2 3 4 5 6 7 8 9 10 "J" "Q" "K" "A" ]
|
||||
func$ name card .
|
||||
return suit$[card mod1 4] & val$[card div1 4]
|
||||
.
|
||||
proc show . .
|
||||
for i to top
|
||||
write name deck[i] & " "
|
||||
.
|
||||
print ""
|
||||
print ""
|
||||
.
|
||||
proc shuffle . .
|
||||
for i = 52 downto 2
|
||||
r = randint i
|
||||
swap deck[i] deck[r]
|
||||
.
|
||||
top = 52
|
||||
.
|
||||
func deal .
|
||||
top -= 1
|
||||
return deck[top + 1]
|
||||
.
|
||||
new
|
||||
show
|
||||
shuffle
|
||||
show
|
||||
for i to 10
|
||||
write name deal & " "
|
||||
.
|
||||
print ""
|
||||
print ""
|
||||
show
|
||||
Loading…
Add table
Add a link
Reference in a new issue