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 numpy as np | |
def redbrain(n=100, b=0.3, sz=100): | |
return [(x, np.random.binomial(n - x, b)) for x in np.random.binomial(n, 0.5, sz)] | |
def foo(n, sz): | |
d = {} | |
for i in range(1, 20): | |
p = i * 0.05 | |
xs = redbrain(n=n, b=p, sz=sz) |
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
{ | |
"Total DeltaV": 7751.744428756014, | |
"Total Weight": 341697, | |
"name": "Minmus Miner, launch from Kerbin to LKO", | |
"stages": [ | |
{ | |
"fuel": 0, | |
"Wet": 0, | |
"name": "Ore", | |
"mt": 0, |
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 json | |
from itertools import starmap | |
def tonne(x): | |
return x*1000.0 | |
def deltaV(Isp, m0, mt, gravitational_acc=9.80665): | |
""" |
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 | |
m = [[-1,1,1,-1,-1,1,1,-1,-1,1],[1,"S",1,"L",-1,-1,-1,-1,-1,-1],[-1,-1,-1,1,1,-1,1,-1,1,1],[1,"L",-1,-1,1,-1,1,-1,1,-1],[-1,1,1,-1,-1,-1,-1,"L",1,-1],[1,-1,1,-1,-1,1,-1,1,-1,1],[-1,"L",-1,-1,-1,1,-1,-1,-1,1],[-1,1,-1,1,1,-1,1,-1,-1,-1],[-1,1,-1,-1,-1,1,1,-1,"G",1],[-1,-1,1,1,-1,-1,-1,1,-1,-1]] | |
print(m) | |
class Position(collections.namedtuple("Position", ['x', 'y'])): | |
__slots__ = () |
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
ws = ["イアラ","ウェイト","オメガロ","ガルヒ","ガングリオンズ","クリオ","ジェノバ","スノウガ","ズビズバ","スペシウム","タグアズ","ドドンパ","トルネ","ネメシス","バイナリル","ハザード","パリピファイア","バルース","ヒラケゴマ","フェイク","プリズマ","ホルーガ","マッハ","マホマホ","ムート","ラリホフ","ランス","ループ","ロールウェイブ","ワロス"] | |
conn = {} | |
for w in ws: | |
for v in ws: | |
if w[-1] == v[0]: | |
conn[(w, v)] = True | |
print(conn) |
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
# coding: utf-8 | |
import itertools | |
def baz(xs, n): | |
ys = list(itertools.zip_longest(xs[n::4], xs[n+1::4], fillvalue=' ')) | |
zs = itertools.zip_longest(ys[0::4], ys[1::4], ys[2::4], ys[3::4], fillvalue=(' ', ' ')) | |
return [[p for ps in z for p in ps] for z in zs] | |
xs = [chr(i) for i in range(ord('a'), ord('z')+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
import io | |
from enum import Enum, auto | |
class Inst(Enum): | |
inbox = auto() | |
outbox = auto() |
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
python3 ShogiELOtourney.py --verbose --resolve --tournament ryuuou30th-2.json --out expected-r1750.json --override 307:1750 |
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
[ | |
[ | |
"村山慈明(id=249, r=1721)", | |
0.0028835519066684858 | |
], | |
[ | |
"渡辺明(id=235, r=1849)", | |
0.5997696089008129 | |
], | |
[ |
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
def isprime(n): | |
for i in range(2, n): | |
if n % i == 0: | |
return False | |
return True | |
class Counter: | |
def __init__(self, n): |
NewerOlder