-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (36 loc) · 1.17 KB
/
main.go
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
43
44
package main
func main() {
config := getConfig()
data, _ := readFromFile(config.HandFileName)
if len(config.HandDeckJoinSeparator) < 1 {
config.HandDeckJoinSeparator = ","
}
previousHand := stringToDeck(string(data), config.HandDeckJoinSeparator)
if len(previousHand) > 0 {
println("=== PREVIOUS HAND ================")
previousHand.print()
println("==================================")
} else {
println("There is not a previous hand.")
}
cards := newDeck()
hand, _ := deal(cards, config.NumberOfCardsToDeal)
println()
println("=== HAND =========================")
hand.print()
println("==================================")
println()
if len(config.HandFileName) < 1 {
println("The hand was not saved because no filename was set on the configuration file (config.json).")
} else {
hand.save(config.HandFileName, config.HandDeckJoinSeparator)
println("The hand was successfully saved.")
}
shuffled := shuffle(hand, config.NumberOfShuffleRounds)
for i, hand := range shuffled {
println()
println("=== SHUFFLE ROUND", i+1, "==============")
hand.print()
println("==================================")
}
}