diff --git a/codes/codes.go b/codes/codes.go index a38ae22..0c4475d 100644 --- a/codes/codes.go +++ b/codes/codes.go @@ -8,10 +8,8 @@ type Code struct { var codes = [256]Code{ {Value: 0b0000, Bits: 4}, {Value: 0b0001, Bits: 4}, - {Value: 0b00100, Bits: 5}, - {Value: 0b00101, Bits: 5}, - {Value: 0b00110, Bits: 5}, - {Value: 0b00111, Bits: 5}, + {Value: 0b0010, Bits: 4}, + {Value: 0b0011, Bits: 4}, {Value: 0b01000, Bits: 5}, {Value: 0b01001, Bits: 5}, {Value: 0b01010, Bits: 5}, @@ -262,6 +260,8 @@ var codes = [256]Code{ {Value: 0b1111111011, Bits: 10}, {Value: 0b1111111100, Bits: 10}, {Value: 0b1111111101, Bits: 10}, + {Value: 0b1111111110, Bits: 10}, + {Value: 0b1111111111, Bits: 10}, } func CodeForIndex(index int) Code { diff --git a/genseed/genseed.go b/genseed/genseed.go index 2c74acd..b7e9677 100644 --- a/genseed/genseed.go +++ b/genseed/genseed.go @@ -24,26 +24,16 @@ func main() { chat := seeds.ChatState() log.Printf("chat=%d [%s]", totalLength(chat, samples), chat) - chatOpt := optimize(chat, samples) - if chatOpt == nil { - log.Printf("\toptimal from further additions") - } else { - log.Printf("\tnot optimal [%s]", chatOpt) - } - opt := optimize(state.NewState(), samples) log.Printf("opt=%d [%s]", totalLength(opt, samples), opt) } func optimize(st *state.State, samples [][]byte) *state.State { - var best *state.State - for true { better := optimize2(st, samples) if better == nil { - return best + return st } - best = better st = better log.Printf("\titer=%d [%s]", totalLength(st, samples), st) } diff --git a/seeds/seeds.go b/seeds/seeds.go index e5dd082..829787c 100644 --- a/seeds/seeds.go +++ b/seeds/seeds.go @@ -5,19 +5,22 @@ import ( ) var chatState = newStateFromSeed([][]byte{ - /* 01 */ []byte("',.0:?CIbgjkpvxz\xea"), - /* 02 */ []byte("\nfw"), - /* 03 */ []byte("cdmuy"), + /* 01 */ []byte("',.?CIbcfjkpvxz\xea"), + /* 02 */ []byte("dgwy"), + /* 03 */ []byte("\nmru"), /* 04 */ []byte("l"), - /* 05 */ []byte("r"), - /* 06 */ []byte("t"), - /* 07 */ []byte("ahos"), - /* 08 */ []byte("in"), + /* 05 */ []byte("hns"), + /* 06 */ []byte("a"), + /* 07 */ []byte(""), + /* 08 */ []byte("i"), /* 09 */ []byte(""), - /* 10 */ []byte(""), - /* 11 */ []byte(" "), + /* 10 */ []byte(" "), + /* 11 */ []byte(""), /* 12 */ []byte(""), - /* 13 */ []byte("e"), + /* 13 */ []byte(""), + /* 14 */ []byte("et"), + /* 15 */ []byte(""), + /* 16 */ []byte("o"), }) func ChatState() *state.State {