basemntunivrse
Also, the following script might help to make the game more accessible (or to help you cheat :P) -
// note: game doesn't seem to automatically clear at the end, so in the dev console use:
// window.localStorage.clear();
// then refresh the page
const prime = n => {
for (let i = 2, s = Math.sqrt(n); i <= s; i++) {
if (n % i === 0) {
return false;
}
}
return n > 1;
}
const generateNums = digits => (
m => [...Array(9 * m).keys()].map(i => i + m)
)(Math.pow(10, digits - 1));
const generate5DigitPrimes = () => generateNums(5).filter(prime);
const all5DigitPrimes = generate5DigitPrimes();
// updated to take an optional array (defaults to all5DigitPrimes)
// this means you can chain the check function to do things that normal regex can't do
// e.g. check(/some_regex/, check(/some_other_regex/))
const check = (r, a = all5DigitPrimes) => a.filter(p => r.test('' + p));
Usage:paste the above code into the dev console
type 'all5DigitPrimes' and press Enter to see a list of all 5-digit primes
type 'check(/some_regular_expression/)' to see a filtered list of primes that match your regular expression
If we move the comma, this becomes: "As I read Numbers, I see"...
OTP on the https://en.wikipedia.org/wiki/Book_of_Numbers, perhaps?
There may well be a lot more to this puzzle than first meets the eye!
Still, my solution (in JS) was a little more verbose than yours...
<img src="puzzle2.png" id="puzzle-image">
<script>
/*
Pink (white) 232,3,138
Blue (black) 58,185,229
*/
window.addEventListener("load", function() {
var image = document.getElementById("puzzle-image"),
canvas = document.createElement("canvas"),
context = canvas.getContext("2d");
canvas.width = image.width;
canvas.height = image.height;
context.drawImage(image, 0, 0, image.width, image.height);
// Test 1 - rle
(function() {
var rle = [], prev = null, count = 0;
for (let y = 0; y < image.height; y++) {
for (let x = 0; x < image.width; x++) {
let pd = context.getImageData(x, y, 1, 1).data;
if (prev === null) {
prev = pd[0];
}
if (pd[0] == prev) {
count++;
} else {
rle.push(count);
count = 1;
prev = pd[0];
}
}
}
var r1 = "";
for (let i = 0; i < rle.length; i++) {
r1 += String.fromCharCode(rle[i]);
}
console.log(r1);
var r2 = "";
for (let i = 0; i < r1.length; i += 3) {
r2 += String.fromCharCode(parseInt(r1[i] + r1[i + 1], 16));
}
console.log(r2);
}());
}, false);
</script>
(Where puzzle2.png is the image in black & white)(Edited to fix indentation...)
This might be quite useful for developers as well, just as a quick indicator instead of having the Developer Tools Network tab open all the time.
One thing that might be quite useful (though it would probably be beyond the scope of this project and perhaps hard to implement) would be the ability to block any further requests made by the tab. A sort of per-tab 'offline mode'. Perhaps as a context menu option when clicking on the icon.
Also, it would be very interesting to see statistics on which popular websites tend to do the most user-activity tracking, lazy loading etc. - but, in order to collect and collate these statistics your extension would itself have to send background requests to some central API. That'd be quite ironic...
Anyway, nice work!
It's a really simple JSON database: you can create lists and fill those lists with chunks of JSON data, all via a REST API.
In many of my projects, I usually find myself repeating the same pattern - building a database and API that serves JSON - so I figured that a generic JSON storage system would make things easier.
To be honest, I'm not really sure how useful this will be to anyone, but I'd love to hear your feedback. Specifically, are there any features that are missing that would also be 'essential' for this sort of thing?
I've got a few ideas for features that might make it even more useful, for example:
- multiple API tokens per account, and the ability to set read/write permissions (per list, or even per item) for each token.
- 'typed lists', where each list has an attached 'JSON schema' which gets checked every time an item is added or modified.
- sorting/searching, where for each list you can define a set of paths (using JSON Pointer format), each path would represent a field that can be sorted or searched on. I'd need to extract the values and index them separately for sorting/searching to be fast.
Anyway, let me know what you think!