Skip to content

Instantly share code, notes, and snippets.

View ddugovic's full-sized avatar
💭
I may be slow to respond.

Daniel Dugovic ddugovic

💭
I may be slow to respond.
View GitHub Profile
@ddugovic
ddugovic / E4_Best_by_Test.user.js
Created October 27, 2017 08:23
E4, Best by Test
// ==UserScript==
// @name E4, Best by Test
// @namespace https://github.com/ddugovic/UserScripts
// @description Best by test!
// @author ddugovic
// @copyright 2017+, ddugovic
// @license CC0 1.0 Universal
// @match https://lichess.org/training/coordinate
// @require https://lichess1.org/assets/compiled/coordinate.js?v=1932
// @grant none
@ddugovic
ddugovic / crazyhouse-puzzles-test.epd
Last active August 27, 2017 13:49
Crazyhouse test positions
% Crazyhouse variant testsuite from https://chessvariants.training/
r6k/pppq2pp/3pp3/4p3/3nP1BP/2NPK1P1/PPP5/3R4[RBBNNPqrb] b - - bm B@f4+
rnb2r2/ppp3p1/4kp2/4pp1Q/3P4/8/PPP2PPP/R1B1KBNR[QBPPnn] w KQ - bm Bc4+ B@d5+
rnbk4/ppp1bp1p/8/4P3/4p3/2N5/PPP2PPP/R1B1KBNR[QRNPPqp] w KQ - bm Q@h8+ Q@g8+
r7/p1p1b1rp/b3kn2/4p1P1/3pP1n1/2NP2P1/PPP2pKP/R1BQ3R[QNPPb] w - - bm Q@d5+
r1b4r/p5pp/2pkp3/3p4/3Pp3/8/P1P2PPP/R2n1RK1[QBNNqbbnppp] w - - bm B@c5+ B@b4+
r3nr1b/ppp2p1k/6p1/4P1qB/3PK3/4Q3/PPP3PP/R7[RBBNNPPnpp] b - - bm Qf5+
r4r1k/ppp2pp1/3N4/3Np3/B5p1/6B1/PP3Pp1/R1BQ1RK1[QNPPPbnpp] w - - bm Q@h6+
1r5k/1P2Q1p1/p3Qnb1/1pp3N1/8/2P1BPp1/PP4P1/R4R1K[BBNrnppppp] w - - bm N@f7+
1rRq1r2/1PppkpQp/p3bN2/1pb1pp2/4P3/2P4N/PP4PP/Rb5K[BNnp] w - - bm Rxd8
@ddugovic
ddugovic / pawn_encoder.rb
Last active June 13, 2017 16:43
Encode white pawns and black pawns into bitmasks
# Program to encode pawns as bitmasks from a FEN
# Usage: ruby pawn_encoder.rb "rn3rk1/4bpp1/pq2bn1p/2pp4/B6B/2N1PN2/PP3PPP/2RQ1RK1"
def encode(fen)
board = fen.gsub("8"," 7").gsub("7"," 6").gsub("6"," 5").gsub("5"," 4").gsub("4"," 3").gsub("3"," 2").gsub("2"," 1").gsub("1"," ")
wpawnsA = board.gsub(/[^P\/]/,"0").gsub(/P/,"1").split("/")
bpawnsA = board.gsub(/[^p\/]/,"0").gsub(/p/,"1").split("/")
wpawnsB = wpawnsA.rotate
bpawnsB = bpawnsA.rotate(-1)
@ddugovic
ddugovic / run.pl
Last active November 7, 2016 12:47
Disclaimer: this generates some redundant files and puts files in the . directory unless specified otherwise
#!/usr/bin/perl
$ENV{'STBWDIR'} = '.';
$ENV{'STBZDIR'} = '.';
$ENV{'STBSTATSDIR'} = '.';
$ENV{'LTBWDIR'} = '.';
$ENV{'LTBZDIR'} = '.';
$ENV{'LTBSTATSDIR'} = '.';
$ENV{'GTBWDIR'} = '.';
$ENV{'GTBZDIR'} = '.';
import gym
import numpy as np
def run_episode(env, parameters):
observation = env.reset()
totalreward = 0
#for 200 timesteps
for _ in xrange(200):
#env.render()
#initalize random weights
@ddugovic
ddugovic / audiosynth.view.js
Last active July 19, 2016 05:29
Attempting to draw some keys. Lovingly copied from http://www.keithwhor.com/music/audiosynth.view.js
var fnCreateKeyboard = function(keyboardElement) {
// Generate keyboard
// This is our main keyboard element! It's populated dynamically based on what you've set above.
visualKeyboard = document.getElementById('keyboard');
selectSound = document.getElementById('sound');
var iKeys = 0;
var iWhite = 0;
var notes = __audioSynth._notes;
@ddugovic
ddugovic / gist:827dcac503f9b458efe49d01888a3a60
Last active May 13, 2016 12:13
Parsey McParseface versus 2007 Miss Teen South Carolina
echo "I personally believe that U.S. Americans are unable to do so because uh some uh people out there in our nation don't have maps and uh I believe that our ed- education like such as in South Africa and uh the- the Iraq everywhere like such as and I believe that they should uh our education over here in the U.S. should help the U.S. or- or- should help South Africa and should help the Iraq and the Asian countries so we will be able to build up our future for our children." | ./syntaxnet/demo.sh
I syntaxnet/term_frequency_map.cc:101] Loaded 46 terms from syntaxnet/models/parsey_mcparseface/label-map.
I syntaxnet/embedding_feature_extractor.cc:35] Features: stack.child(1).label stack.child(1).sibling(-1).label stack.child(-1).label stack.child(-1).sibling(1).label stack.child(2).label stack.child(-2).label stack(1).child(1).label stack(1).child(1).sibling(-1).label stack(1).child(-1).label stack(1).child(-1).sibling(1).label stack(1).child(2).label stack(1).child(-2).label; input.token.tag input(1).token.ta
@ddugovic
ddugovic / test-epd.py
Last active November 24, 2017 12:25 — forked from niklasf/bratko-kopec.py
An implementation of the Bratko-Kopec Test using python-chess
#!/usr/bin/python
import chess
import chess.uci
import sys
import time
def test_epd(engine, epd):
position = chess.Board()