Skip to content

Instantly share code, notes, and snippets.

View questsin's full-sized avatar

Nicholas Manolakos questsin

View GitHub Profile
<img dragable="true">
/*jslint nomen: true */
/*global prompt, alert, confirm, window, self, Audio, $, jQuery, console, _, document, */
/*jslint node: true, regexp: true, maxerr: 200 */
const fs = require('fs');
const testFolder = '../metadata/';
fs.readdir(testFolder, (err, files) => {
var Dexie = require('dexie');
var db = new Dexie('hellodb');
db.version(1).stores({
tasks: '++id,date,description,done'
});
// Don't be confused over Dexie.spawn() and yield here. It's not required for using Dexie,
// but it really simplifies the code. If you're a Promise Ninja, use vanilla promise
// style instead.
Dexie.spawn(function*() {
#!/usr/bin/env node
//chmod u+x yourscript
var express = require('express');
var prompt = require('prompt');
//cli
var fs = require('fs');
var stdin = process.stdin;
var stdout = process.stdout;
function Chessy(cfg) {
this.board = new ChessBoard('board', cfg);
this.game = new Chess();
}
Chessy.prototype.orientation = function() {
return this.board.orientation();
};
'use strict';
/** Helper function for 2 leading zeros padding. */
var __pad2 = function __pad2(n) {
return ('00' + n).slice(-2);
};
/** Format how dates will be displayed. Used in the highscore list. */
var DATE_FMT = self.Intl ? new Intl.DateTimeFormat('de', {
year: 'numeric', month: '2-digit', day: '2-digit'
var startStr = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
var board = [ 'rnbqkbnr','pppppppp','8','8','8','8','PPPPPPPP','RNBQKBNR'];
var meta = ' w KQkq - 0 1';
function generateChess960() {
var C960Array = new Array(8);
var str = "01234567";
var Bwx = (Math.floor(Math.random() * 4) * 2) + 1;
C960Array[Bwx] = "B";
/**
* > require('chess-ai.js').search(new require('chess.js').Chess);
* 'd5'
*/
var MAX_SEARCH_DEPTH_LIMIT = 3;
var MAX_SEARCH_TIME_LIMIT = 500; // ms
var values = {
'pieces':{ 'p':33, 'r':41, 'n':37, 'b':37, 'q':45, 'k':49 },
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="200" height="100"
style="border:1px solid #c3c3c3;">
Your browser does not support the HTML5 canvas tag.
</canvas>
<script>
//LRU Cache
//https://github.com/monsur/jscache
//https://github.com/rsms/js-lru
//todo: transposition table, LRU Cache, WithMemory
//var Cache = new Object(); // or just {}
// show the values stored
//for (var k in Cache) {
// use hasOwnProperty to filter out keys from the Object.prototype
// if (Cache.hasOwnProperty(k)) {