Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.babelrc
.eslintrc
.gitignore
LICENSE
README.md
package-lock.json
package.json
polyfills.js
webpack.common.js
webpack.dev.js
webpack.prod.js

README.md

Treasure Game

npm run build && surge --domain treasure.surge.sh

Demo

Explanation

The idea here is to demonstrate the power of binary search algorithms to non-programmers and beginner programmers. The user should first try and create a strategy for finding the treasure. Most likely the user will stumble upon a strategy very similar to binary search. Try starting with a one dimensional array first.

Binary search strategy can be summarized by: dividing the grid in half each time until you reach one possible cell. The number of times it takes to divide a number in half until you reach one is the definition of log_base_2(N). Therefore, in this case the best number of guesses is log_base_2(totalCells). Checkout the solver tab to see binary search in action.

I would like to turn this in to a talk at some point and create a parallel to advent calendars. Here are some slides.

Built with ❤️ by David Alberto Adler. Source code on github.