|
@@ -4,7 +4,6 @@ import (
|
|
"crypto/sha1"
|
|
"crypto/sha1"
|
|
"encoding/binary"
|
|
"encoding/binary"
|
|
"fmt"
|
|
"fmt"
|
|
- "log"
|
|
|
|
"math/rand"
|
|
"math/rand"
|
|
"red-green/door"
|
|
"red-green/door"
|
|
"strconv"
|
|
"strconv"
|
|
@@ -81,46 +80,29 @@ func NormalizeDate(date *time.Time) {
|
|
}
|
|
}
|
|
|
|
|
|
func cmdLineRender(bracket string, inner string, outer string) func(string) string {
|
|
func cmdLineRender(bracket string, inner string, outer string) func(string) string {
|
|
- cmdRender := func(input string) string {
|
|
|
|
- var result string
|
|
|
|
|
|
+ return func(input string) string {
|
|
|
|
+ var r door.Render = door.Render{Line: input}
|
|
inOuter := true
|
|
inOuter := true
|
|
- var lastColor string
|
|
|
|
|
|
|
|
for _, c := range input {
|
|
for _, c := range input {
|
|
if c == '[' {
|
|
if c == '[' {
|
|
inOuter = false
|
|
inOuter = false
|
|
- if lastColor != bracket {
|
|
|
|
- result += bracket
|
|
|
|
- lastColor = bracket
|
|
|
|
- }
|
|
|
|
- result += string(c)
|
|
|
|
|
|
+ r.Append(bracket, 1)
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
if c == ']' {
|
|
if c == ']' {
|
|
inOuter = true
|
|
inOuter = true
|
|
- if lastColor != bracket {
|
|
|
|
- result += bracket
|
|
|
|
- lastColor = bracket
|
|
|
|
- }
|
|
|
|
- result += string(c)
|
|
|
|
|
|
+ r.Append(bracket, 1)
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
if inOuter {
|
|
if inOuter {
|
|
- if lastColor != outer {
|
|
|
|
- result += outer
|
|
|
|
- lastColor = outer
|
|
|
|
- }
|
|
|
|
|
|
+ r.Append(outer, 1)
|
|
} else {
|
|
} else {
|
|
- if lastColor != inner {
|
|
|
|
- result += inner
|
|
|
|
- lastColor = inner
|
|
|
|
- }
|
|
|
|
|
|
+ r.Append(inner, 1)
|
|
}
|
|
}
|
|
- result += string(c)
|
|
|
|
}
|
|
}
|
|
- return result
|
|
|
|
|
|
+ return r.Result
|
|
}
|
|
}
|
|
- return cmdRender
|
|
|
|
}
|
|
}
|
|
|
|
|
|
func (pc *PlayCards) InitValues() {
|
|
func (pc *PlayCards) InitValues() {
|
|
@@ -538,7 +520,7 @@ Next_Hand:
|
|
var seed int64 = int64(binary.BigEndian.Uint64(result[0:8]))
|
|
var seed int64 = int64(binary.BigEndian.Uint64(result[0:8]))
|
|
pc.RNG.Seed(seed)
|
|
pc.RNG.Seed(seed)
|
|
// I'm seeing changes in the seed_seq bytes, but the seed is the same number.
|
|
// I'm seeing changes in the seed_seq bytes, but the seed is the same number.
|
|
- log.Printf("%#v\nSeed %d\nLen %d\nresult %#v\n", seed_seq, seed, len(seed_seq), result)
|
|
|
|
|
|
+ // log.Printf("%#v\nSeed %d\nLen %d\nresult %#v\n", seed_seq, seed, len(seed_seq), result)
|
|
|
|
|
|
pc.Deck = ShuffleCards(pc.RNG, 1)
|
|
pc.Deck = ShuffleCards(pc.RNG, 1)
|
|
pc.State = MakeCardStates(1)
|
|
pc.State = MakeCardStates(1)
|