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
/** | |
* For local visualizer | |
* Make sure to apply/unapply changes in FastLed for stub platform | |
* | |
* Finally compile the visualizer with | |
* g++ demo_simple.cpp -I../../../Projects/FastLED/src -lsfml-graphics -lsfml-window -lsfml-system -pthread | |
* And run with | |
* ./a.out | |
*/ |
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
import math | |
import random | |
# merchant is good for selling metal -> crystal | |
# and selling deut -> metal or crystal | |
# fleeters don't like when you sell deut -> metal / crystal | |
# (as this wastes finite amount of deuterium in the game) | |
# Global exchange rate of [mcd] to [mcd] |
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
# 2020-05-08 version 1.3 | |
import re | |
import os | |
import sys | |
def merge(int96): | |
return int96[0] + (int96[1] << 32) + (int96[2] << 64) | |
def res96(residual): |
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
# 2020-05-08 version 1.1 | |
def merge(int96): | |
return int96[0] + (int96[1] << 32) + (int96[2] << 64) | |
def res96(residual): | |
mask = (1 << 32) - 1 | |
parts = [(residual >> (32 * i)) & mask for i in range(3)] | |
# bits = [part if part >= 0 else ((1 << 32) - part) for part in parts] |
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
#!/usr/bin/env perl | |
use warnings; | |
use strict; | |
use Math::GMPz; | |
use Math::BigInt only => "GMP"; | |
use Math::BigFloat only => "GMP"; | |
use Math::Prime::Util qw/:all/; | |
use Math::Prime::Util::GMP; # Ensure we're using this | |
use Term::ReadKey; # Used to read terminal key presses without requiring 'Enter' to be pressed | |
use Time::HiRes qw(gettimeofday time tv_interval); |
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
#!/usr/bin/env perl | |
use warnings; | |
use strict; | |
use threads; | |
use threads::shared; | |
use Timer::Runtime; | |
use Math::GMPz; | |
use Math::BigFloat lib=>"GMP"; | |
use Math::Prime::Util qw/:all/; | |
$|=1; |
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
""" | |
$ python | |
Python 3.6.7 (default, Oct 22 2018, 11:32:17) | |
[GCC 8.2.0] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from bs4 import BeautifulSoup | |
>>> html = """<html><body><b><center>Chapter 5</center></b></body></html>""" | |
>>> soup = BeautifulSoup(html, "lxml") | |
>>> html | |
'<html><body><b><center>Chapter 5</center></b></body></html>' |
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
import random | |
import choix | |
import numpy as np | |
M = 20 | |
PAIRS = 150 | |
PENALTY = 0.1 | |
models = list(range(M)) |
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
import collections | |
import math | |
import itertools | |
import time | |
from PIL import ImageGrab | |
import win32api | |
import win32con | |
INF = 1000000 |
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
import math | |
def LL(x): | |
return 1/(1+10**(-x/400)) | |
def LLF(wins,losses, p0, p1): | |
# from sethtrois@ https://github.com/gcp/leela-zero/issues/378#issuecomment-351639093 | |
winLog = math.log(p1 / p0) | |
lossLog = math.log((1-p1) / (1-p0)) |
NewerOlder