Skip to main content
edited body
Source Link
Martin Ender
  • 198.4k
  • 67
  • 455
  • 999

CJam, 309 bytes

This is just a quick baseline solution. I'm sorry I did this in a golfing language, but it was actually the simplest way to do it. I'll add an explanation of the actual code tomorrow, but I've outlined the algorithm below.

Encoder

q~{);}%);:+:(9b95b32f+:c

Decoder

l:i32f-95b9b95b9bW%[0]64*+64<W%:)8/{_:+45\-+}%z{_:+45\-+}%z`

Test it here.

The input of the encoder (on STDIN) and the output of the decoder (on STDOUT) are in the form of a nested CJam array. E.g.

[[8 3 5 4 1 6 9 2 7] [2 9 6 8 5 7 4 3 1] [4 1 7 2 9 3 6 5 8] [5 6 9 1 3 4 7 8 2] [1 2 3 6 7 8 5 4 9] [7 4 8 5 2 9 1 6 3] [6 5 2 7 8 1 3 9 4] [9 8 1 3 4 5 2 7 6] [3 7 4 9 6 2 8 1 5]]

The 10 test outputs are:

U(5wtqmC.-[TM.#aMY#k*)pErHQcg'{
EWrn"^@p+g<5XT5G[r1|bk?q6Nx4~r?
#489pLj5+ML+z@y$]8a@CI,K}B$$Mwn
LF_X^"-h**A!'VZq kHT@F:"ZMD?A0r
?gD;"tw<yG%8y!3S"BC:ojQ!#;i-:\g
qS#"L%`4yei?Ce_r`{@EOl66m^hx77
"EF?` %!H@YX6J0F93->%90O7T#C_5u
JXqMi^=]XY9Q.e'|BgJ#],5.OS1`9V)R+6@Jx(_3jg@@U6.DrMO*5G'P<OHv8
(Ua6z{V:hX#sV@g0s<|!X[T,Jy|oQ+K
N,F8F1!@OH1%%zs%dI`Q\q,~oAEl(:O

The algorithm is very simple:

  • Remove the last column and row.
  • Treat the remaining 64 digits as a base-9 number (after decrementing each digit by 1).
  • Convert that to base-95, add 32 to each digit and turn that into the corresponding ASCII character.
  • For the decoding, reverse the base conversion and fill in the the final column and row with the missing numbers.

CJam, 309 bytes

This is just a quick baseline solution. I'm sorry I did this in a golfing language, but it was actually the simplest way to do it. I'll add an explanation of the actual code tomorrow, but I've outlined the algorithm below.

Encoder

q~{);}%);:+:(9b95b32f+:c

Decoder

l:i32f-95b9b:)8/{_:+45\-+}%z{_:+45\-+}%z`

Test it here.

The input of the encoder (on STDIN) and the output of the decoder (on STDOUT) are in the form of a nested CJam array. E.g.

[[8 3 5 4 1 6 9 2 7] [2 9 6 8 5 7 4 3 1] [4 1 7 2 9 3 6 5 8] [5 6 9 1 3 4 7 8 2] [1 2 3 6 7 8 5 4 9] [7 4 8 5 2 9 1 6 3] [6 5 2 7 8 1 3 9 4] [9 8 1 3 4 5 2 7 6] [3 7 4 9 6 2 8 1 5]]

The 10 test outputs are:

U(5wtqmC.-[TM.#aMY#k*)pErHQcg'{
EWrn"^@p+g<5XT5G[r1|bk?q6Nx4~r?
#489pLj5+ML+z@y$]8a@CI,K}B$$Mwn
LF_X^"-h**A!'VZq kHT@F:"ZMD?A0r
?gD;"tw<yG%8y!3S"BC:ojQ!#;i-:\g
qS#"L%`4yei?Ce_r`{@EOl66m^hx77
"EF?` %!H@YX6J0F93->%90O7T#C_5u
JXqMi^=]XY9Q.e'|BgJ#],5.OS1`(_3
(Ua6z{V:hX#sV@g0s<|!X[T,Jy|oQ+K
N,F8F1!@OH1%%zs%dI`Q\q,~oAEl(:O

The algorithm is very simple:

  • Remove the last column and row.
  • Treat the remaining 64 digits as a base-9 number (after decrementing each digit by 1).
  • Convert that to base-95, add 32 to each digit and turn that into the corresponding ASCII character.
  • For the decoding, reverse the base conversion and fill in the the final column and row with the missing numbers.

CJam, 309 bytes

This is just a quick baseline solution. I'm sorry I did this in a golfing language, but it was actually the simplest way to do it. I'll add an explanation of the actual code tomorrow, but I've outlined the algorithm below.

Encoder

q~{);}%);:+:(9b95b32f+:c

Decoder

l:i32f-95b9bW%[0]64*+64<W%:)8/{_:+45\-+}%z{_:+45\-+}%z`

Test it here.

The input of the encoder (on STDIN) and the output of the decoder (on STDOUT) are in the form of a nested CJam array. E.g.

[[8 3 5 4 1 6 9 2 7] [2 9 6 8 5 7 4 3 1] [4 1 7 2 9 3 6 5 8] [5 6 9 1 3 4 7 8 2] [1 2 3 6 7 8 5 4 9] [7 4 8 5 2 9 1 6 3] [6 5 2 7 8 1 3 9 4] [9 8 1 3 4 5 2 7 6] [3 7 4 9 6 2 8 1 5]]

The 10 test outputs are:

U(5wtqmC.-[TM.#aMY#k*)pErHQcg'{
EWrn"^@p+g<5XT5G[r1|bk?q6Nx4~r?
#489pLj5+ML+z@y$]8a@CI,K}B$$Mwn
LF_X^"-h**A!'VZq kHT@F:"ZMD?A0r
?gD;"tw<yG%8y!3S"BC:ojQ!#;i-:\g
qS#"L%`4yei?Ce_r`{@EOl66m^hx77
"EF?` %!H@YX6J0F93->%90O7T#C_5u
9V)R+6@Jx(jg@@U6.DrMO*5G'P<OHv8
(Ua6z{V:hX#sV@g0s<|!X[T,Jy|oQ+K
N,F8F1!@OH1%%zs%dI`Q\q,~oAEl(:O

The algorithm is very simple:

  • Remove the last column and row.
  • Treat the remaining 64 digits as a base-9 number (after decrementing each digit by 1).
  • Convert that to base-95, add 32 to each digit and turn that into the corresponding ASCII character.
  • For the decoding, reverse the base conversion and fill in the the final column and row with the missing numbers.
deleted 191 characters in body
Source Link
Martin Ender
  • 198.4k
  • 67
  • 455
  • 999

CJam, 31309 bytes

This is just a quick baseline solution. I'm sorry I did this in a golfing language, but it was actually the simplest way to do it. I'll add an explanation of the actual code tomorrow, but I've outlined the algorithm below.

Encoder

q~{);}%);:+:(9b95b32f+:c

Decoder

l:i32f-95b9b:)8/{_:+45\-+}%z{_:+45\-+}%z`

Test it here.

The input of the encoder (on STDIN) and the output of the decoder (on STDOUT) are in the form of a nested CJam array.

As an example, the input E.g.

[[8 3 5 4 1 6 9 2 7] [2 9 6 8 5 7 4 3 1] [4 1 7 2 9 3 6 5 8] [5 6 9 1 3 4 7 8 2] [1 2 3 6 7 8 5 4 9] [7 4 8 5 2 9 1 6 3] [6 5 2 7 8 1 3 9 4] [9 8 1 3 4 5 2 7 6] [3 7 4 9 6 2 8 1 5]]

will be encoded asThe 10 test outputs are:

U(5wtqmC.-[TM.#aMY#k*)pErHQcg'{
EWrn"^@p+g<5XT5G[r1|bk?q6Nx4~r?
#489pLj5+ML+z@y$]8a@CI,K}B$$Mwn
LF_X^"-h**A!'VZq kHT@F:"ZMD?A0r
?gD;"tw<yG%8y!3S"BC:ojQ!#;i-:\g
qS#"L%`4yei?Ce_r`{@EOl66m^hx77
"EF?` %!H@YX6J0F93->%90O7T#C_5u
JXqMi^=]XY9Q.e'|BgJ#],5.OS1`(_3
(Ua6z{V:hX#sV@g0s<|!X[T,Jy|oQ+K
N,F8F1!@OH1%%zs%dI`Q\q,~oAEl(:O

The algorithm is very simple:

  • Remove the last column and row.
  • Treat the remaining 64 digits as a base-9 number (after decrementing each digit by 1).
  • Convert that to base-95, add 32 to each digit and turn that into the corresponding ASCII character.
  • For the decoding, reverse the base conversion and fill in the the final column and row with the missing numbers.

CJam, 31 bytes

This is just a quick baseline solution. I'm sorry I did this in a golfing language, but it was actually the simplest way to do it. I'll add an explanation of the actual code tomorrow, but I've outlined the algorithm below.

Encoder

q~{);}%);:+:(9b95b32f+:c

Decoder

l:i32f-95b9b:)8/{_:+45\-+}%z{_:+45\-+}%z`

Test it here.

The input of the encoder (on STDIN) and the output of the decoder (on STDOUT) are in the form of a nested CJam array.

As an example, the input

[[8 3 5 4 1 6 9 2 7] [2 9 6 8 5 7 4 3 1] [4 1 7 2 9 3 6 5 8] [5 6 9 1 3 4 7 8 2] [1 2 3 6 7 8 5 4 9] [7 4 8 5 2 9 1 6 3] [6 5 2 7 8 1 3 9 4] [9 8 1 3 4 5 2 7 6] [3 7 4 9 6 2 8 1 5]]

will be encoded as

LF_X^"-h**A!'VZq kHT@F:"ZMD?A0r

The algorithm is very simple:

  • Remove the last column and row.
  • Treat the remaining 64 digits as a base-9 number (after decrementing each digit by 1).
  • Convert that to base-95, add 32 to each digit and turn that into the corresponding ASCII character.
  • For the decoding, reverse the base conversion and fill in the the final column and row with the missing numbers.

CJam, 309 bytes

This is just a quick baseline solution. I'm sorry I did this in a golfing language, but it was actually the simplest way to do it. I'll add an explanation of the actual code tomorrow, but I've outlined the algorithm below.

Encoder

q~{);}%);:+:(9b95b32f+:c

Decoder

l:i32f-95b9b:)8/{_:+45\-+}%z{_:+45\-+}%z`

Test it here.

The input of the encoder (on STDIN) and the output of the decoder (on STDOUT) are in the form of a nested CJam array. E.g.

[[8 3 5 4 1 6 9 2 7] [2 9 6 8 5 7 4 3 1] [4 1 7 2 9 3 6 5 8] [5 6 9 1 3 4 7 8 2] [1 2 3 6 7 8 5 4 9] [7 4 8 5 2 9 1 6 3] [6 5 2 7 8 1 3 9 4] [9 8 1 3 4 5 2 7 6] [3 7 4 9 6 2 8 1 5]]

The 10 test outputs are:

U(5wtqmC.-[TM.#aMY#k*)pErHQcg'{
EWrn"^@p+g<5XT5G[r1|bk?q6Nx4~r?
#489pLj5+ML+z@y$]8a@CI,K}B$$Mwn
LF_X^"-h**A!'VZq kHT@F:"ZMD?A0r
?gD;"tw<yG%8y!3S"BC:ojQ!#;i-:\g
qS#"L%`4yei?Ce_r`{@EOl66m^hx77
"EF?` %!H@YX6J0F93->%90O7T#C_5u
JXqMi^=]XY9Q.e'|BgJ#],5.OS1`(_3
(Ua6z{V:hX#sV@g0s<|!X[T,Jy|oQ+K
N,F8F1!@OH1%%zs%dI`Q\q,~oAEl(:O

The algorithm is very simple:

  • Remove the last column and row.
  • Treat the remaining 64 digits as a base-9 number (after decrementing each digit by 1).
  • Convert that to base-95, add 32 to each digit and turn that into the corresponding ASCII character.
  • For the decoding, reverse the base conversion and fill in the the final column and row with the missing numbers.
deleted 191 characters in body
Source Link
Martin Ender
  • 198.4k
  • 67
  • 455
  • 999

CJam, 31 bytes

This is just a quick baseline solution. I'm sorry I did this in a golfing languageslanguage, but it was actually the simplest way to do it.

Input I'll add an explanation of the board as a nested CJam array on STDIN:actual code tomorrow, but I've outlined the algorithm below.

[[8 3 5 4 1 6 9 2 7] [2 9 6 8 5 7 4 3 1] [4 1 7 2 9 3 6 5 8] [5 6 9 1 3 4 7 8 2] [1 2 3 6 7 8 5 4 9] [7 4 8 5 2 9 1 6 3] [6 5 2 7 8 1 3 9 4] [9 8 1 3 4 5 2 7 6] [3 7 4 9 6 2 8 1 5]]

The encoding program isEncoder

l~q~{);}%);:+:(9b95b32f+:c

which would result in

LF_X^"-h**A!'VZq kHT@F:"ZMD?A0r

for the above example.

Then the decoding program isDecoder

l:i32f-95b9b:)8/{_:+45\-+}%z{_:+45\-+}%z`

which printsTest it here.

The input of the encoder (on STDIN) and the output of the decoder (on STDOUT) are in the form of a nested CJam array.

As an example, the input

[[8 3 5 4 1 6 9 2 7] [2 9 6 8 5 7 4 3 1] [4 1 7 2 9 3 6 5 8] [5 6 9 1 3 4 7 8 2] [1 2 3 6 7 8 5 4 9] [7 4 8 5 2 9 1 6 3] [6 5 2 7 8 1 3 9 4] [9 8 1 3 4 5 2 7 6] [3 7 4 9 6 2 8 1 5]]

back to STDOUT.will be encoded as

Test it here.

LF_X^"-h**A!'VZq kHT@F:"ZMD?A0r

The algorithm is very simple:

  • Remove the last column and row.
  • Treat the remaining 64 digits as a base-9 number (after decrementing each digit by 1).
  • Convert that to base-95, add 32 to each digit and turn that into the corresponding ASCII character.
  • For the decoding, reverse the base conversion and fill in the the final column and row with the missing numbers.

CJam, 31 bytes

This is just a quick baseline solution. I'm sorry I did this in a golfing languages, but it was actually the simplest way to do it.

Input of the board as a nested CJam array on STDIN:

[[8 3 5 4 1 6 9 2 7] [2 9 6 8 5 7 4 3 1] [4 1 7 2 9 3 6 5 8] [5 6 9 1 3 4 7 8 2] [1 2 3 6 7 8 5 4 9] [7 4 8 5 2 9 1 6 3] [6 5 2 7 8 1 3 9 4] [9 8 1 3 4 5 2 7 6] [3 7 4 9 6 2 8 1 5]]

The encoding program is

l~{);}%);:+:(9b95b32f+:c

which would result in

LF_X^"-h**A!'VZq kHT@F:"ZMD?A0r

for the above example.

Then the decoding program is

l:i32f-95b9b:)8/{_:+45\-+}%z{_:+45\-+}%z`

which prints

[[8 3 5 4 1 6 9 2 7] [2 9 6 8 5 7 4 3 1] [4 1 7 2 9 3 6 5 8] [5 6 9 1 3 4 7 8 2] [1 2 3 6 7 8 5 4 9] [7 4 8 5 2 9 1 6 3] [6 5 2 7 8 1 3 9 4] [9 8 1 3 4 5 2 7 6] [3 7 4 9 6 2 8 1 5]]

back to STDOUT.

Test it here.

The algorithm is very simple:

  • Remove the last column and row.
  • Treat the remaining 64 digits as a base-9 number (after decrementing each digit by 1).
  • Convert that to base-95, add 32 to each digit and turn that into the corresponding ASCII character.
  • For the decoding, reverse the base conversion and fill in the the final column and row with the missing numbers.

CJam, 31 bytes

This is just a quick baseline solution. I'm sorry I did this in a golfing language, but it was actually the simplest way to do it. I'll add an explanation of the actual code tomorrow, but I've outlined the algorithm below.

Encoder

q~{);}%);:+:(9b95b32f+:c

Decoder

l:i32f-95b9b:)8/{_:+45\-+}%z{_:+45\-+}%z`

Test it here.

The input of the encoder (on STDIN) and the output of the decoder (on STDOUT) are in the form of a nested CJam array.

As an example, the input

[[8 3 5 4 1 6 9 2 7] [2 9 6 8 5 7 4 3 1] [4 1 7 2 9 3 6 5 8] [5 6 9 1 3 4 7 8 2] [1 2 3 6 7 8 5 4 9] [7 4 8 5 2 9 1 6 3] [6 5 2 7 8 1 3 9 4] [9 8 1 3 4 5 2 7 6] [3 7 4 9 6 2 8 1 5]]

will be encoded as

LF_X^"-h**A!'VZq kHT@F:"ZMD?A0r

The algorithm is very simple:

  • Remove the last column and row.
  • Treat the remaining 64 digits as a base-9 number (after decrementing each digit by 1).
  • Convert that to base-95, add 32 to each digit and turn that into the corresponding ASCII character.
  • For the decoding, reverse the base conversion and fill in the the final column and row with the missing numbers.
Source Link
Martin Ender
  • 198.4k
  • 67
  • 455
  • 999
Loading