24 lines
503 B
JavaScript
24 lines
503 B
JavaScript
import * as Decoder from Share.Decoder;
|
|
import * as Encoder from Share.Encoder;
|
|
import {iter, square} from Grid.Util;
|
|
|
|
return {
|
|
compress: compress,
|
|
naive: naive
|
|
}
|
|
|
|
function compress(grid) {
|
|
}
|
|
|
|
function naiveEncode(grid) {
|
|
var encoder = Encoder.make();
|
|
iter(grid, function(row, column) {
|
|
encoder.int(3)(grid[row][column]);
|
|
});
|
|
return encoder.output();
|
|
}
|
|
|
|
function naiveDecode(size, input) {
|
|
var decoder = Decoder.make(input);
|
|
return generate(size, size, function() {return decoder.int(3);});
|
|
}
|