-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoSH-CardEngine.ps1
42 lines (33 loc) · 1.19 KB
/
PoSH-CardEngine.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Card Engine
# Early version
# Suits or card types (TCGs/CCGs: "Land", "Creature", etc.)
$spades = "2♠","3♠","4♠","5♠","6♠","7♠","8♠","9♠","10♠","J♠","Q♠","K♠","A♠"
$diamonds = "2♦","3♦","4♦","5♦","6♦","7♦","8♦","9♦","10♦","J♦","Q♦","K♦","A♦"
$hearts = "2♥","3♥","4♥","5♥","6♥","7♥","8♥","9♥","10♥","J♥","Q♥","K♥","A♥"
$clubs = "2♣","3♣","4♣","5♣","6♣","7♣","8♣","9♣","10♣","J♣","Q♣","K♣","A♣"
# Define what makes up the deck and its length
$deck = $spades + $diamonds + $hearts + $clubs
$pool = ($deck.length)
$hand =
# Basic loop to cycle through and remove all cards in $deck
function draw {
param ($climb)
for ($i=1; $i -le $climb; $i++){
$card = ""
$hand =
$card = ($deck | get-random)
$global:hand = $hand |? {$_ + $card}
$global:deck = $global:deck |? {$_ -ne $card}
#$card
$global:hand
}
}
$hand = draw 2
# Basic loop to cycle through and remove all cards in $deck
#foreach ($card in $deck){
#$card = ""
#$hand = ""
#$card = ($deck | get-random)
#$card
#$deck = $deck |? {$_ -ne $card}
#}