-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (41 loc) · 1.03 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
45
package main
import (
"bufio"
"fmt"
"main/combinations"
"main/mapper"
"main/model"
"os"
"strconv"
)
func main() {
var table []model.Card
var input string
fmt.Println("Available colors: grey, black, green, purple")
for {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Enter text: ")
input, _ = reader.ReadString('\n')
card, err := mapper.StringToCard(input)
if err != nil {
fmt.Println(err)
} else {
table = append(table, card)
fmt.Println("check four set: ", combinations.IsFourSetCombination(table))
fmt.Println("check three set: ", combinations.IsThreeSetCombination(table))
fmt.Println("check three sequence: ", combinations.IsThreeSequenceCombination(table))
fmt.Println("check four sequence: ", combinations.IsFourSequenceCombination(table))
printTable(table)
}
}
}
func printTable(table []model.Card) {
result := "["
var num string
for _, card := range table {
num = strconv.Itoa(int(card.Number))
result += string(card.Color) + " " + num + ", "
}
result = result + "]"
fmt.Println(result)
}