This file contains hidden or 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
<img dragable="true"> |
This file contains hidden or 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
/*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) => { |
This file contains hidden or 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
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*() { |
This file contains hidden or 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
#!/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; |
This file contains hidden or 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
function Chessy(cfg) { | |
this.board = new ChessBoard('board', cfg); | |
this.game = new Chess(); | |
} | |
Chessy.prototype.orientation = function() { | |
return this.board.orientation(); | |
}; |
This file contains hidden or 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
'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' |
This file contains hidden or 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
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"; |
This file contains hidden or 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
/** | |
* > 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 }, |
This file contains hidden or 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> | |
<body> | |
<canvas id="myCanvas" width="200" height="100" | |
style="border:1px solid #c3c3c3;"> | |
Your browser does not support the HTML5 canvas tag. | |
</canvas> | |
<script> |
This file contains hidden or 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
//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)) { |