This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Recursive shadowcasting</title> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
margin: 0; | |
} | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Recursive shadowcasting algorithm. | |
* This algorithm creates a field of view centered around (x, y). | |
* Opaque tiles are treated as if they have beveled edges. | |
* Transparent tiles are visible only if their center is visible, so the | |
* algorithm is symmetric. | |
* @param cx - x coordinate of center | |
* @param cy - y coordinate of center | |
* @param transparent - function that takes (x, y) as arguments and returns the transparency of that tile | |
* @param reveal - callback function that reveals the tile at (x, y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html><head><title></title><script> | |
const [query, bang] = window.location.search.substring(3).split('!'); | |
const [root, search] = { | |
b: ['bing.com/', 'search?q='], | |
bi: ['bing.com/images/', 'search?q='], | |
g: ['google.com/', '#q='], | |
i: ['google.com/search?tbm=isch', '&q='], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Modifies the lichess.org analysis board engine line suggestions. | |
* Instead of jumping to the move that gets clicked, | |
* clicking anywhere on an engine line will play the first move of the line. | |
*/ | |
/** | |
* Prevents clicking on children of the pv container. | |
* This works because clicking on the container itself will automatically play the first move of the pv. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Chessground = { | |
/** reconfigure the instance */ | |
set( | |
options: Exclude< | |
Options, | |
{ | |
viewOnly: boolean; | |
minimalDom: boolean; | |
} | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.spinner { | |
background: no-repeat center url("data:image/svg+xml;utf8,%3Csvg%20viewBox%3D'-2%20-2%2054%2054'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%3Cmask%20id%3D'a'%3E%3Cpath%20id%3D'c'%20pathLength%3D'1'%20fill%3D'none'%20stroke%3D'white'%20stroke-width%3D'3.77953'%20stroke-dasharray%3D'1'%20d%3D'm%2021.776255%2C12.644596%20c%20-1.28368%2C8.43561%208.943332%2C12.698588%2014.537976%2C17.606142%203.000307%2C2.631832%204.41181%2C4.442404%205.683988%2C7.930417'%20%2F%3E%3Cpath%20id%3D'd'%20pathLength%3D'1'%20fill%3D'none'%20stroke%3D'white'%20stroke-width%3D'4.15748'%20stroke-dasharray%3D'1'%20d%3D'M%2043.186954%2C36.323824%20C%2046.003963%2C35.12034%2049.845597%2C30.841626%2048.627889%2C28.700886%2046.377142%2C24.744054%2039.744879%2C14.01233%2036.740396%2C8.9693395%2036.318664%2C8.2614666%2036.497278%2C7.1347125%2037.33348%2C5.6694471%2038.691731%2C3.2894037%2039.28973%2C0.04112172%2039.28973%2C0.04112172'%20%2F%3E%3Cpath%20id%3D'e'%20pathLength%3D'1'%20fill%3D'none'%20stroke%3D'white'%20strok |