Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@qgustavor
Last active June 24, 2020 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qgustavor/535b73e1b49897c1b9411a712871851f to your computer and use it in GitHub Desktop.
Save qgustavor/535b73e1b49897c1b9411a712871851f to your computer and use it in GitHub Desktop.
Hidamari Puzzle

Hiramari Puzzle

In Hidamari Sketch x 365 there is a scene where appears a blackboard with the following code:

594853742
659063875
790548285
856498764
696464839

36500006A

As found in this blog the code 36500006A probally means the following: 365 (from the anime title), episode 6, part A.

But what intrigates me is the numbers. I tried to decode numbers those in many ways:

  • Reading those from the left to right then top to bottom (yokogaki);
  • Reading those from the top to bottom then right to left (tategaki);
  • Ignoring prime numbers;
  • Ignoring even numbers;
  • Ignoring odd numbers;
  • Parsing the numbers as ASCII codes;
  • Parsing the numbers as indexes in the latin alphabet;
  • And many other ways...

I also tried to make heatmaps so I could find some pattern, but no success.

Does someone have a solution to this puzzle?

const yokogaki = '594853742659063875790548285856498764696464839'
const tategaki = yokogaki.match(/.{9}/g).reduce((state, el) => {
el.split('').forEach((e, i) => {
state[9 - i] = (state[9 - i] || '') + e
})
return state
}, []).join('')
const noFilter = () => true
const isPrime = e => [2, 3, 5, 7].includes(+e)
const isNotPrime = e => !isPrime(e)
const isEven = e => [0, 2, 4, 6, 8].includes(+e)
const isOdd = e => [1, 3, 5, 7, 9].includes(+e)
const parseNone = e => e.split('').map(e => +e)
const createParser = (order, size, delta = 0) => e => {
const map = Array.from(new Set(e.split(''))).sort()
if (map.length > order || e.length % size !== 0) return []
return e
.replace(/./g, e => (map.indexOf(e) + delta) % order)
.match(new RegExp('.{' + size + '}', 'g'))
.map(e => parseInt(e, order))
}
const limitParser = max => e => {
return e.split('').reduce((state, element) => {
const last = state[state.length - 1]
if (!last || Number(last + element) > max) {
state.push(element)
} else {
state[state.length - 1] += element
}
return state
}, []).map(e => +e)
}
const alphabetLower = 'abcdefghijklmnopqrstuvwxyz'
const alphabetUpper = alphabetLower.toUpperCase()
const alphabet = alphabetLower + alphabetUpper
const formatNone = e => e
const formatLower = e => alphabetLower.charAt(e)
const formatLetter = e => alphabet.charAt(e)
const formatAlpha = e => e.toString(36)
const formatAlphaInverse = e => alphabet.charAt(e) || (e - 26 * 2)
const formatAscii = e => String.fromCharCode(e)
const formatHex = e => e.toString(16)
const found = new Set()
;[yokogaki, tategaki].forEach(e => {
;[noFilter, isPrime, isNotPrime, isEven, isOdd].forEach(filter => {
const filtered = e.split('').filter(filter).join('')
;[
parseNone,
limitParser(16), limitParser(32), limitParser(64), limitParser(128), limitParser(256),
createParser(4, 2), createParser(4, 3), createParser(4, 3, 2), createParser(4, 3, 2),
createParser(8, 2), createParser(8, 3),
createParser(8, 2), createParser(8, 2, 2), createParser(8, 2, 4), createParser(8, 2, 6),
createParser(8, 3), createParser(8, 3, 2), createParser(8, 3, 4), createParser(8, 3, 6)
].forEach(parse => {
const parsed = parse(filtered)
;[formatLower, formatLetter, formatAlpha, formatAlphaInverse, formatAscii].forEach(format => {
const formatted = parsed.map(format).join('')
if (formatted) {
found.add(formatted)
}
})
})
})
})
console.log(Array.from(found).sort().join('\n'))
@qgustavor
Copy link
Author

The strange thing is that this sequence changes in other seasons, like here: https://i.stack.imgur.com/IvrQU.png

If I (or someone else) rewatch this anime I will take more screenshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment