message-size-increase #3
@ -64,6 +64,18 @@ func (sn Snake) Check(data []byte) (ok bool, n int) {
|
|||||||
return true, n
|
return true, n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Flatten returns the snake flattened to a byte array. The result of this
|
||||||
|
// function always satisfies the snake.
|
||||||
|
func (sn Snake) Flatten() []byte {
|
||||||
|
flat := []byte { }
|
||||||
|
for _, sector := range sn {
|
||||||
|
for _, variation := range sector {
|
||||||
|
flat = append(flat, variation...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flat
|
||||||
|
}
|
||||||
|
|
||||||
func (sn Snake) String() string {
|
func (sn Snake) String() string {
|
||||||
if len(sn) == 0 || len(sn[0]) == 0 || len(sn[0][0]) == 0 {
|
if len(sn) == 0 || len(sn[0]) == 0 || len(sn[0][0]) == 0 {
|
||||||
return "EMPTY"
|
return "EMPTY"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user