Skip to content

Instantly share code, notes, and snippets.

@aSapien
Last active August 13, 2018 07:24
Show Gist options
  • Save aSapien/8c69e63b9ca9a63c338c78f400d09ad5 to your computer and use it in GitHub Desktop.
Save aSapien/8c69e63b9ca9a63c338c78f400d09ad5 to your computer and use it in GitHub Desktop.
[Code Golf Game] The shortest code wins (according to the instructions here: https://grammarly.ai/code-golf/) #challange #game #golf #code
// version 1
z = (k, a, b, c) => (
i = r => k in r[0] ? r[0][k] : r[1],
d = j => Intl.DateTimeFormat('en', { month: 'long' }).format(new Date().setMonth(j)),
f = [[...[,,,,].fill(0.1) ,3.6], 1],
g = [[1,10,5,9,7,3,7,8], 6],
h = [[1,1,2,2,2,2,5,3,3,1], k % 2],
`\nJDK ${ a.toFixed(k > 4 ? 0 : 1) } ${k < 11 ? 'was' : 'will be' } released in ${d(b)} ${c}` + (41 < k ? '' : z(k+1, a + i(f), b + i(g), c + i(h)))
)
throw z(0, 1.0, 0, 1996)
//version 2
z = (k, b, c) => (
i = r => k in r[0] ? r[0][k] : r[1],
d = new Date,
d.setMonth(b),
g = [[1,10,5,9,7,3,7,8], 6],
h = [[1,1,2,2,2,2,5,3,3,1], k % 2],
`\nJDK ${ k < 5 ? '1.' + k : k } ${k < 11 ? 'was' : 'will be' } released in ${d.toLocaleString('en',{ month: "long" })} ${c}` +
(41 < k ? '' : z(k+1, b + i(g), c + i(h)))
)
throw z(0, 0, 1996)
@aSapien
Copy link
Author

aSapien commented May 25, 2018

photo5474289247772060216

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