Skip to content

Instantly share code, notes, and snippets.

View niklasf's full-sized avatar

Niklas Fiekas niklasf

View GitHub Profile
This file has been truncated, but you can view the full file.
{"n": "King's Indian: S\u00e4misch, Orthodox, 7.Nge2 c6", "f": "rnbq1rk1/pp3pbp/2pp1np1/4p3/2PPP3/2N1BP2/PP2N1PP/R2QKB1R w KQ", "c": "E86a", "m": "d2d4 g8f6 c2c4 g7g6 b1c3 f8g7 e2e4 d7d6 f2f3 e8g8 c1e3 e7e5 g1e2 c7c6"}
{"n": "Sicilian: Najdorf, Polugaevsky, 10.Qe2 Nfd7 11.O-O-O Bb7", "f": "rn2kb1r/1bqn1ppp/p3p3/1p2P1B1/3N4/2N5/PPP1Q1PP/2KR1B1R w kq", "c": "B96v", "m": "e2e4 c7c5 g1f3 d7d6 d2d4 c5d4 f3d4 g8f6 b1c3 a7a6 c1g5 e7e6 f2f4 b7b5 e4e5 d6e5 f4e5 d8c7 d1e2 f6d7 e1c1 c8b7"}
{"n": "Queen's Indian: Pomar, Polugaevsky Variation", "f": "rn1q1rk1/pbppbppp/1p3n2/3p4/2P4N/6P1/PP2PPBP/RNBQ1RK1 b -", "c": "E17w", "m": "d2d4 g8f6 c2c4 e7e6 g1f3 b7b6 g2g3 c8b7 f1g2 f8e7 e1g1 e8g8 d4d5 e6d5 f3h4"}
{"n": "Sicilian: Taimanov, Szen, Hedgehog Variation", "f": "r1bq1rk1/4bppp/ppnppn2/8/2P1P3/N1N5/PP2BPPP/R1BQ1RK1 w -", "c": "B44w", "m": "e2e4 c7c5 g1f3 e7e6 d2d4 c5d4 f3d4 b8c6 d4b5 d7d6 c2c4 g8f6 b1c3 a7a6 b5a3 f8e7 f1e2 e8g8 e1g1 b7b6"}
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import json
import collections
import chess
import chess.pgn
db = {}
--- a/masters.pgn 2016-02-08 16:00:16.000000000 +0100
+++ b/masters.pgn 2016-02-16 16:34:55.645514341 +0100
@@ -39522220,21 +39522220,21 @@
[WhiteElo "2591"]
[BlackElo "2327"]
[PlyCount "93"]
[EventDate "2010.11.13"]
[EventType "swiss"]
[EventRounds "9"]
[EventCountry "CHN"]
@niklasf
niklasf / huffman-pgn.py
Created January 3, 2016 15:58
Compress and decompress chess games using huffman encoding
import bitarray
import chess
import chess.pgn
import sys
import pickle
import textwrap
def base_counts():
counts = {}
@niklasf
niklasf / fuzz-engine.py
Last active September 17, 2015 03:49
Fuzz testing for UCI engines
#!/usr/bin/python3
# Fuzz testing for UCI engines using python-chess.
import chess
import chess.uci
import random
import logging
import sys
random.seed(123456)
@niklasf
niklasf / bratko-kopec.py
Last active February 24, 2020 15:37
An implementation of the Bratko-Kopec Test using python-chess
#!/usr/bin/python
import chess
import chess.uci
import sys
import time
MOVETIME = 120.0
@niklasf
niklasf / check_temperature.pl
Last active August 29, 2015 14:09
Nagios plugin that checks the temperature of thermal_zone0
#!/usr/bin/perl
#
# Copyright (c) 2014 Niklas Fiekas <niklas.fiekas@tu-clausthal.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@niklasf
niklasf / feasible.c
Last active August 29, 2015 14:09
Compute a deterministic strategy to sustain the highest feasible discounted payoff in the battle of the sexes
#include <stdio.h>
#include <gmp.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
if (argc <= 1) {
printf("Give number of iterations as arguments!\n");
}
mpq_t husband, wife, value, delta;
#!/usr/bin/python2
import random
import math
# Model
# =====
class TicTacToeGrid(object):
def __init__(self):
#!/bin/sh
#
# Ausführen um Raspbian (oder ein anderes Debian) zu einem Anzeiger für IServ
# zu konfigurieren.
# Superuser Rechte holen.
if [ $(id -u) -ne 0 ]; then
echo Superuser Rechte nötig.
exit 1
fi