brilliant!
HN user
escanor
it is:
(async function(oracle, punch, delay) {
async function sleep(ms) {
return new Promise((resolve, _) => {
setTimeout(resolve, ms)
})
}
for (let i = 0; i < 100; i++) {
const state = oracle._state
const block = oracle.predictNextPunch()
oracle._state = state
punch(block === 'L' ? 'R' : 'L')
await sleep(delay)
}
})(oracle, punch, 150)pure random player:
(async function(punch, delay) {
async function sleep(ms) {
return new Promise((resolve, _) => {
setTimeout(resolve, ms)
})
}
for (let i = 0; i < 100; i++) {
punch(['L', 'R'][(Math.random() * 2) | 0])
await sleep(delay)
}
})(punch, 150)
"cheating" player: (async function(oracle, punch, delay) {
async function sleep(ms) {
return new Promise((resolve, _) => {
setTimeout(resolve, ms)
})
}
for (let i = 0; i < 100; i++) {
punch((i + 1) < oracle.minForPrediction ? ['L', 'R'][(Math.random() * 2) | 0] : oracle.predictNextPunch() === 'L' ? 'R' : 'L')
await sleep(delay)
}
})(oracle, punch, 150)
is it possible to do any better? i haven't fully read frog/oracle codeWho does that algorithm really serve?
great work! just a note regarding tf-idf, when you mention log10: i think you're missing the point on the reason of log and most importantly base 10. namely, using log10 gives us a perspective on the number of digits of the term/document frequency. if a term "A" occurs 23 times and a term "B" occurs 50, they will have a very close representation (because both numbers are 2 digits ones).
anyway, thanks for the submission
for index, item in enumerate(menu):
should be
for index, item in enumerate(menu, start=1):
for the example to be correct :)
yes, i see this as well. at first it was confusing, but later i understood it was the output.
My understanding is that the neural network is used to predict the "magnitude" of each eigenvector/axe (extracted by using PCA) in order to reconstruct an approximation of the original behavior.